From 90a3a66c305499a82a32dccd27632605dbfba8df Mon Sep 17 00:00:00 2001 From: PoweRGbg Date: Wed, 13 Jun 2018 09:49:37 +0300 Subject: [PATCH] Revert "Merge remote-tracking branch 'upstream/rsoption' into dev" This reverts commit 233fb33659f5918c81ed323ffda6f2e6cfcbf09a, reversing changes made to f1f8bae2d1d53f9ae0e27e9b65da9fb3a1dc1e03. --- app/src/main/AndroidManifest.xml | 4 +- .../nightscout/androidaps/MainActivity.java | 9 +- .../info/nightscout/androidaps/MainApp.java | 3 - .../androidaps/Services/DataService.java | 55 -- .../androidaps/Services/Intents.java | 2 - .../androidaps/interfaces/PluginBase.java | 5 - .../interfaces/PluginDescription.java | 6 - .../plugins/Actions/ActionsPlugin.java | 1 - .../plugins/Actions/dialogs/FillDialog.java | 69 +- .../plugins/Careportal/CareportalPlugin.java | 3 - .../plugins/Common/SubscriberFragment.java | 2 +- .../ConfigBuilder/ConfigBuilderFragment.java | 431 ++++++++---- .../ConfigBuilder/ConfigBuilderPlugin.java | 1 - .../ObjectivesPlugin.java | 1 - .../androidaps/plugins/Food/FoodPlugin.java | 1 - .../Insulin/InsulinOrefBasePlugin.java | 1 - .../Insulin/InsulinOrefFreePeakPlugin.java | 3 +- .../Insulin/InsulinOrefRapidActingPlugin.java | 3 +- .../InsulinOrefUltraRapidActingPlugin.java | 3 +- .../androidaps/plugins/Loop/LoopPlugin.java | 1 - .../NSClientInternal/NSClientPlugin.java | 1 - .../plugins/OpenAPSAMA/OpenAPSAMAPlugin.java | 1 - .../plugins/OpenAPSMA/OpenAPSMAPlugin.java | 1 - .../plugins/OpenAPSSMB/OpenAPSSMBPlugin.java | 1 - .../Overview/Dialogs/WizardDialog.java | 5 +- .../plugins/Overview/OverviewFragment.java | 5 +- .../plugins/Overview/OverviewPlugin.java | 1 - .../PersistentNotificationPlugin.java | 1 - .../ProfileLocal/LocalProfilePlugin.java | 1 - .../plugins/ProfileNS/NSProfilePlugin.java | 1 - .../ProfileSimple/SimpleProfilePlugin.java | 1 - .../plugins/PumpCombo/ComboPlugin.java | 1 - .../PumpDanaR/AbstractDanaRPlugin.java | 1 - .../plugins/PumpDanaR/DanaRFragment.java | 29 +- .../plugins/PumpDanaR/DanaRPlugin.java | 2 +- .../activities/DanaRUserOptionsActivity.java | 30 +- .../PumpDanaR/comm/MessageHashTable.java | 2 +- .../PumpDanaR/comm/MsgSetUserOptions.java | 58 -- .../PumpDanaR/comm/MsgSettingUserOptions.java | 56 +- .../AbstractDanaRExecutionService.java | 1 - .../services/DanaRExecutionService.java | 37 +- .../services/DanaRKoreanExecutionService.java | 5 - .../plugins/PumpDanaRS/DanaRSPlugin.java | 1 - .../plugins/PumpDanaRv2/DanaRv2Plugin.java | 11 +- .../PumpDanaRv2/comm/MessageHashTable_v2.java | 1 - .../services/DanaRv2ExecutionService.java | 29 +- .../plugins/PumpInsight/InsightPlugin.java | 1 - .../androidaps/plugins/PumpMDI/MDIPlugin.java | 1 - .../PumpVirtual/VirtualPumpPlugin.java | 2 - .../SensitivityAAPSPlugin.java | 1 - .../SensitivityOref0Plugin.java | 1 - .../SensitivityWeightedAveragePlugin.java | 1 - .../SmsCommunicatorPlugin.java | 1 - .../plugins/Source/SourceDexcomG5Plugin.java | 1 - .../plugins/Source/SourceGlimpPlugin.java | 1 - .../plugins/Source/SourceMM640gPlugin.java | 1 - .../plugins/Source/SourceNSClientPlugin.java | 1 - .../plugins/Source/SourcePoctechPlugin.java | 39 -- .../plugins/Source/SourceXdripPlugin.java | 1 - .../plugins/Treatments/TreatmentsPlugin.java | 1 - .../androidaps/plugins/Wear/WearPlugin.java | 1 - .../XDripStatusline/StatuslinePlugin.java | 1 - .../androidaps/queue/CommandQueue.java | 2 +- .../androidaps/setupwizard/SWDefinition.java | 183 +---- .../setupwizard/elements/SWPlugin.java | 15 +- .../androidaps/tabs/TabPageAdapter.java | 9 +- .../main/res/drawable-hdpi/ic_visibility.png | Bin 953 -> 0 bytes .../main/res/drawable-mdpi/ic_visibility.png | Bin 413 -> 0 bytes .../main/res/drawable-xhdpi/ic_visibility.png | Bin 847 -> 0 bytes .../res/drawable-xxhdpi/ic_visibility.png | Bin 2094 -> 0 bytes .../res/drawable-xxxhdpi/ic_visibility.png | Bin 2090 -> 0 bytes .../res/drawable/visibility_black_16x16.png | Bin 0 -> 233 bytes app/src/main/res/layout/bgsource_fragment.xml | 1 - .../main/res/layout/careportal_fragment.xml | 1 - .../main/res/layout/combopump_fragment.xml | 1 - .../res/layout/configbuilder_fragment.xml | 625 ++++++------------ .../res/layout/configbuilder_simpleitem.xml | 42 ++ .../layout/configbuilder_single_plugin.xml | 63 -- app/src/main/res/layout/danar_fragment.xml | 1 - app/src/main/res/layout/loop_fragment.xml | 1 - .../main/res/layout/objectives_fragment.xml | 1 - .../main/res/layout/openapsama_fragment.xml | 1 - app/src/main/res/layout/overview_fragment.xml | 9 - .../res/layout/overview_fragment_nsclient.xml | 11 +- .../overview_fragment_nsclient_tablet.xml | 9 - .../layout/overview_fragment_smallheight.xml | 11 +- app/src/main/res/layout/wear_fragment.xml | 1 - app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values-ro/strings.xml | 488 +------------- app/src/main/res/values/colors.xml | 9 +- app/src/main/res/values/strings.xml | 50 -- app/src/main/res/values/styles.xml | 7 + app/src/main/res/xml/pref_dexcomg5.xml | 1 + app/src/main/res/xml/pref_poctech.xml | 19 - 94 files changed, 697 insertions(+), 1808 deletions(-) delete mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgSetUserOptions.java delete mode 100644 app/src/main/java/info/nightscout/androidaps/plugins/Source/SourcePoctechPlugin.java delete mode 100644 app/src/main/res/drawable-hdpi/ic_visibility.png delete mode 100644 app/src/main/res/drawable-mdpi/ic_visibility.png delete mode 100644 app/src/main/res/drawable-xhdpi/ic_visibility.png delete mode 100644 app/src/main/res/drawable-xxhdpi/ic_visibility.png delete mode 100644 app/src/main/res/drawable-xxxhdpi/ic_visibility.png create mode 100644 app/src/main/res/drawable/visibility_black_16x16.png create mode 100644 app/src/main/res/layout/configbuilder_simpleitem.xml delete mode 100644 app/src/main/res/layout/configbuilder_single_plugin.xml delete mode 100644 app/src/main/res/xml/pref_poctech.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b66cba183f..798c858a10 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -83,8 +83,6 @@ - - @@ -172,7 +170,7 @@ { Intent intent = new Intent(this, SingleFragmentActivity.class); intent.putExtra("plugin", MainApp.getPluginsList().indexOf(p)); startActivity(intent); - ((DrawerLayout) findViewById(R.id.drawer_layout)).closeDrawers(); return true; }); } diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index a677b65d6a..45aff91654 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -69,7 +69,6 @@ import info.nightscout.androidaps.plugins.Source.SourceDexcomG5Plugin; import info.nightscout.androidaps.plugins.Source.SourceGlimpPlugin; import info.nightscout.androidaps.plugins.Source.SourceMM640gPlugin; import info.nightscout.androidaps.plugins.Source.SourceNSClientPlugin; -import info.nightscout.androidaps.plugins.Source.SourcePoctechPlugin; import info.nightscout.androidaps.plugins.Source.SourceXdripPlugin; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.androidaps.plugins.Wear.WearPlugin; @@ -179,8 +178,6 @@ public class MainApp extends Application { pluginsList.add(SourceGlimpPlugin.getPlugin()); if (!Config.NSCLIENT) pluginsList.add(SourceDexcomG5Plugin.getPlugin()); - if (!Config.NSCLIENT) - pluginsList.add(SourcePoctechPlugin.getPlugin()); if (Config.SMSCOMMUNICATORENABLED) pluginsList.add(SmsCommunicatorPlugin.getPlugin()); pluginsList.add(FoodPlugin.getPlugin()); diff --git a/app/src/main/java/info/nightscout/androidaps/Services/DataService.java b/app/src/main/java/info/nightscout/androidaps/Services/DataService.java index f8a9ed5d5e..f8437d8d36 100644 --- a/app/src/main/java/info/nightscout/androidaps/Services/DataService.java +++ b/app/src/main/java/info/nightscout/androidaps/Services/DataService.java @@ -13,7 +13,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import info.nightscout.androidaps.Config; -import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.ProfileStore; @@ -39,7 +38,6 @@ import info.nightscout.androidaps.plugins.Source.SourceDexcomG5Plugin; import info.nightscout.androidaps.plugins.Source.SourceGlimpPlugin; import info.nightscout.androidaps.plugins.Source.SourceMM640gPlugin; import info.nightscout.androidaps.plugins.Source.SourceNSClientPlugin; -import info.nightscout.androidaps.plugins.Source.SourcePoctechPlugin; import info.nightscout.androidaps.plugins.Source.SourceXdripPlugin; import info.nightscout.androidaps.receivers.DataReceiver; import info.nightscout.utils.BundleLogger; @@ -56,7 +54,6 @@ public class DataService extends IntentService { boolean mm640gEnabled = false; boolean glimpEnabled = false; boolean dexcomG5Enabled = false; - boolean poctechEnabled = false; public DataService() { super("DataService"); @@ -73,49 +70,36 @@ public class DataService extends IntentService { mm640gEnabled = false; glimpEnabled = false; dexcomG5Enabled = false; - poctechEnabled = false; } else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceXdripPlugin.class)) { xDripEnabled = true; nsClientEnabled = false; mm640gEnabled = false; glimpEnabled = false; dexcomG5Enabled = false; - poctechEnabled = false; } else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceNSClientPlugin.class)) { xDripEnabled = false; nsClientEnabled = true; mm640gEnabled = false; glimpEnabled = false; dexcomG5Enabled = false; - poctechEnabled = false; } else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceMM640gPlugin.class)) { xDripEnabled = false; nsClientEnabled = false; mm640gEnabled = true; glimpEnabled = false; dexcomG5Enabled = false; - poctechEnabled = false; } else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceGlimpPlugin.class)) { xDripEnabled = false; nsClientEnabled = false; mm640gEnabled = false; glimpEnabled = true; dexcomG5Enabled = false; - poctechEnabled = false; } else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourceDexcomG5Plugin.class)) { xDripEnabled = false; nsClientEnabled = false; mm640gEnabled = false; glimpEnabled = false; dexcomG5Enabled = true; - poctechEnabled = false; - } else if (ConfigBuilderPlugin.getPlugin().getActiveBgSource().getClass().equals(SourcePoctechPlugin.class)) { - xDripEnabled = false; - nsClientEnabled = false; - mm640gEnabled = false; - glimpEnabled = false; - dexcomG5Enabled = false; - poctechEnabled = true; } boolean isNSProfile = MainApp.getConfigBuilder().getActiveProfileInterface() != null && MainApp.getConfigBuilder().getActiveProfileInterface().getClass().equals(NSProfilePlugin.class); @@ -145,10 +129,6 @@ public class DataService extends IntentService { if (dexcomG5Enabled) { handleNewDataFromDexcomG5(intent); } - } else if (Intents.POCTECH_BG.equals(action)) { - if (poctechEnabled) { - handleNewDataFromPoctech(intent); - } } else if (Intents.ACTION_NEW_SGV.equals(action)) { if (nsClientEnabled || SP.getBoolean(R.string.key_ns_autobackfill, true)) handleNewDataFromNSClient(intent); @@ -270,41 +250,6 @@ public class DataService extends IntentService { } } - private void handleNewDataFromPoctech(Intent intent) { - - Bundle bundle = intent.getExtras(); - if (bundle == null) return; - - BgReading bgReading = new BgReading(); - - String data = bundle.getString("data"); - log.debug("Received Poctech Data", data); - - try { - JSONArray jsonArray = new JSONArray(data); - log.debug("Received Poctech Data size:" + jsonArray.length()); - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject json = jsonArray.getJSONObject(i); - bgReading.value = json.getDouble("current"); - bgReading.direction = json.getString("direction"); - bgReading.date = json.getLong("date"); - bgReading.raw = json.getDouble("raw"); - if (JsonHelper.safeGetString(json, "utils", Constants.MGDL).equals("mmol/L")) - bgReading.value = bgReading.value * Constants.MMOLL_TO_MGDL; - boolean isNew = MainApp.getDbHelper().createIfNotExists(bgReading, "Poctech"); - if (isNew && SP.getBoolean(R.string.key_dexcomg5_nsupload, false)) { - NSUpload.uploadBg(bgReading); - } - if (isNew && SP.getBoolean(R.string.key_dexcomg5_xdripupload, false)) { - NSUpload.sendToXdrip(bgReading); - } - } - - } catch (JSONException e) { - e.printStackTrace(); - } - } - private void handleNewDataFromMM640g(Intent intent) { Bundle bundle = intent.getExtras(); if (bundle == null) return; diff --git a/app/src/main/java/info/nightscout/androidaps/Services/Intents.java b/app/src/main/java/info/nightscout/androidaps/Services/Intents.java index 25485fb34d..744530c8f2 100644 --- a/app/src/main/java/info/nightscout/androidaps/Services/Intents.java +++ b/app/src/main/java/info/nightscout/androidaps/Services/Intents.java @@ -49,6 +49,4 @@ public interface Intents { String GLIMP_BG = "it.ct.glicemia.ACTION_GLUCOSE_MEASURED"; String DEXCOMG5_BG = "com.dexcom.cgm.DATA"; - - String POCTECH_BG = "com.china.poctech.data"; } diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java index ed9b5672a2..1173936430 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java @@ -57,11 +57,6 @@ public abstract class PluginBase { return getName(); } - public String getDescription() { - if (pluginDescription.description == -1) return null; - else return MainApp.gs(pluginDescription.description); - } - public PluginType getType() { return pluginDescription.mainType; } diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.java index 1634fc672d..c86ae639fa 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginDescription.java @@ -9,7 +9,6 @@ public class PluginDescription { boolean showInList = true; int pluginName = -1; int shortName = -1; - int description = -1; int preferencesId = -1; int advancedPreferencesId = -1; public boolean enableByDefault = false; @@ -75,11 +74,6 @@ public class PluginDescription { return this; } - public PluginDescription description(int description) { - this.description = description; - return this; - } - public String getFragmentClass() { return fragmentClass; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsPlugin.java index ff6275c9c9..2397410693 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsPlugin.java @@ -17,7 +17,6 @@ public class ActionsPlugin extends PluginBase { .fragmentClass(ActionsFragment.class.getName()) .pluginName(R.string.actions) .shortName(R.string.actions_shortname) - .description(R.string.description_actions) ); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java index 558a7c381c..7b9b8570d6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java @@ -61,10 +61,6 @@ public class FillDialog extends DialogFragment implements OnClickListener { private EditText notesEdit; - //one shot guards - private boolean accepted; - private boolean okClicked; - final private TextWatcher textWatcher = new TextWatcher() { @Override public void afterTextChanged(Editable s) { @@ -167,14 +163,7 @@ public class FillDialog extends DialogFragment implements OnClickListener { } - private synchronized void confirmAndDeliver() { - if (okClicked) { - log.debug("guarding: ok already clicked"); - dismiss(); - return; - } - okClicked = true; - + private void confirmAndDeliver() { try { Double insulin = SafeParse.stringToDouble(editInsulin.getText()); @@ -209,40 +198,32 @@ public class FillDialog extends DialogFragment implements OnClickListener { if (insulinAfterConstraints > 0 || pumpSiteChangeCheckbox.isChecked() || insulinCartridgeChangeCheckbox.isChecked()) { builder.setMessage(Html.fromHtml(Joiner.on("
").join(confirmMessage))); builder.setPositiveButton(MainApp.gs(R.string.primefill), (dialog, id) -> { - synchronized (builder) { - if (accepted) { - log.debug("guarding: already accepted"); - return; - } - accepted = true; - - if (finalInsulinAfterConstraints > 0) { - DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); - detailedBolusInfo.insulin = finalInsulinAfterConstraints; - detailedBolusInfo.context = context; - detailedBolusInfo.source = Source.USER; - detailedBolusInfo.isValid = false; // do not count it in IOB (for pump history) - detailedBolusInfo.notes = notes; - ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() { - @Override - public void run() { - if (!result.success) { - Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); - i.putExtra("soundid", R.raw.boluserror); - i.putExtra("status", result.comment); - i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror)); - i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - MainApp.instance().startActivity(i); - } + if (finalInsulinAfterConstraints > 0) { + DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); + detailedBolusInfo.insulin = finalInsulinAfterConstraints; + detailedBolusInfo.context = context; + detailedBolusInfo.source = Source.USER; + detailedBolusInfo.isValid = false; // do not count it in IOB (for pump history) + detailedBolusInfo.notes = notes; + ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() { + @Override + public void run() { + if (!result.success) { + Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class); + i.putExtra("soundid", R.raw.boluserror); + i.putExtra("status", result.comment); + i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror)); + i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + MainApp.instance().startActivity(i); } - }); - FabricPrivacy.getInstance().logCustom(new CustomEvent("Fill")); - } - if (pumpSiteChangeCheckbox.isChecked()) - NSUpload.uploadEvent(CareportalEvent.SITECHANGE, now(), notes); - if (insulinCartridgeChangeCheckbox.isChecked()) - NSUpload.uploadEvent(CareportalEvent.INSULINCHANGE, now() + 1000, notes); + } + }); + FabricPrivacy.getInstance().logCustom(new CustomEvent("Fill")); } + if (pumpSiteChangeCheckbox.isChecked()) + NSUpload.uploadEvent(CareportalEvent.SITECHANGE, now(), notes); + if (insulinCartridgeChangeCheckbox.isChecked()) + NSUpload.uploadEvent(CareportalEvent.INSULINCHANGE, now() + 1000, notes); }); } else { builder.setMessage(MainApp.gs(R.string.no_action_selected)); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalPlugin.java index 22aa4686b2..1428880a81 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalPlugin.java @@ -23,9 +23,6 @@ public class CareportalPlugin extends PluginBase { .fragmentClass(CareportalFragment.class.getName()) .pluginName(R.string.careportal) .shortName(R.string.careportal_shortname) - .visibleByDefault(true) - .enableByDefault(true) - .description(R.string.description_careportal) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Common/SubscriberFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Common/SubscriberFragment.java index fabd83f0ea..5ca9232646 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Common/SubscriberFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Common/SubscriberFragment.java @@ -21,7 +21,7 @@ abstract public class SubscriberFragment extends Fragment { updateGUI(); } - @Override public synchronized void onDestroyView() { + @Override public void onDestroyView() { super.onDestroyView(); if (unbinder != null) unbinder.unbind(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java index e91ad8079f..e92ca52cd9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderFragment.java @@ -1,31 +1,30 @@ package info.nightscout.androidaps.plugins.ConfigBuilder; +import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; -import android.widget.ImageButton; +import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.RadioButton; -import android.widget.ScrollView; +import android.widget.ListAdapter; +import android.widget.ListView; import android.widget.TextView; import com.crashlytics.android.answers.CustomEvent; import java.util.ArrayList; -import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; -import butterknife.OnCheckedChanged; import butterknife.OnClick; -import butterknife.Optional; -import butterknife.Unbinder; +import info.nightscout.androidaps.Config; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.PreferencesActivity; import info.nightscout.androidaps.R; @@ -51,47 +50,69 @@ import info.nightscout.utils.PasswordProtection; public class ConfigBuilderFragment extends SubscriberFragment { - private List pluginViews = new ArrayList<>(); + @BindView(R.id.configbuilder_insulinlistview) + ListView insulinListView; + @BindView(R.id.configbuilder_sensitivitylistview) + ListView sensitivityListView; + @BindView(R.id.configbuilder_bgsourcelistview) + ListView bgsourceListView; + @BindView(R.id.configbuilder_bgsourcelabel) + TextView bgsourceLabel; + @BindView(R.id.configbuilder_pumplistview) + ListView pumpListView; + @BindView(R.id.configbuilder_pumplabel) + TextView pumpLabel; + @BindView(R.id.configbuilder_looplistview) + ListView loopListView; + @BindView(R.id.configbuilder_looplabel) + TextView loopLabel; + @BindView(R.id.configbuilder_treatmentslistview) + ListView treatmentsListView; + @BindView(R.id.configbuilder_treatmentslabel) + TextView treatmentsLabel; + @BindView(R.id.configbuilder_profilelistview) + ListView profileListView; + @BindView(R.id.configbuilder_profilelabel) + TextView profileLabel; + @BindView(R.id.configbuilder_apslistview) + ListView apsListView; + @BindView(R.id.configbuilder_apslabel) + TextView apsLabel; + @BindView(R.id.configbuilder_constraintslistview) + ListView constraintsListView; + @BindView(R.id.configbuilder_constraintslabel) + TextView constraintsLabel; + @BindView(R.id.configbuilder_generallistview) + ListView generalListView; - @BindView(R.id.profile_plugins) - LinearLayout profilePlugins; - @BindView(R.id.insulin_plugins) - LinearLayout insulinPlugins; - @BindView(R.id.bgsource_plugins) - LinearLayout bgSourcePlugins; - @BindView(R.id.pump_plugins) - LinearLayout pumpPlugins; - @BindView(R.id.sensitivity_plugins) - LinearLayout sensitivityPlugins; - @BindView(R.id.aps_plugins) - LinearLayout apsPlugins; - @BindView(R.id.loop_plugins) - LinearLayout loopPlugins; - @BindView(R.id.constraints_plugins) - LinearLayout constraintsPlugins; - @BindView(R.id.treatments_plugins) - LinearLayout treatmentsPlugins; - @BindView(R.id.general_plugins) - LinearLayout generalPlugins; - - @BindView(R.id.main_layout) - ScrollView mainLayout; - @BindView(R.id.unlock) + @BindView(R.id.configbuilder_mainlayout) + LinearLayout mainLayout; + @BindView(R.id.configbuilder_unlock) Button unlock; + PluginCustomAdapter insulinDataAdapter = null; + PluginCustomAdapter sensivityDataAdapter = null; + PluginCustomAdapter bgsourceDataAdapter = null; + PluginCustomAdapter pumpDataAdapter = null; + PluginCustomAdapter loopDataAdapter = null; + PluginCustomAdapter treatmentDataAdapter = null; + PluginCustomAdapter profileDataAdapter = null; + PluginCustomAdapter apsDataAdapter = null; + PluginCustomAdapter constraintsDataAdapter = null; + PluginCustomAdapter generalDataAdapter = null; + @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { try { View view = inflater.inflate(R.layout.configbuilder_fragment, container, false); + unbinder = ButterKnife.bind(this, view); if (PasswordProtection.isLocked("settings_password")) mainLayout.setVisibility(View.GONE); - else unlock.setVisibility(View.GONE); - - createViews(); - + else + unlock.setVisibility(View.GONE); return view; } catch (Exception e) { FabricPrivacy.logException(e); @@ -100,49 +121,222 @@ public class ConfigBuilderFragment extends SubscriberFragment { return null; } - @OnClick(R.id.unlock) - void onClickUnlock() { + @OnClick(R.id.configbuilder_unlock) + public void onClickUnlock() { PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", () -> { mainLayout.setVisibility(View.VISIBLE); unlock.setVisibility(View.GONE); }, null); } - @Override - public void onDestroyView() { - super.onDestroyView(); - for (PluginView pluginView : pluginViews) pluginView.unbind(); - pluginViews.clear(); - } @Override protected void updateGUI() { - for (PluginView pluginView : pluginViews) pluginView.update(); - } - private void createViews() { - createViewsForPlugins(profilePlugins, MainApp.getSpecificPluginsVisibleInListByInterface(ProfileInterface.class, PluginType.PROFILE)); - createViewsForPlugins(insulinPlugins, MainApp.getSpecificPluginsVisibleInListByInterface(InsulinInterface.class, PluginType.INSULIN)); - createViewsForPlugins(bgSourcePlugins, MainApp.getSpecificPluginsVisibleInListByInterface(BgSourceInterface.class, PluginType.BGSOURCE)); - createViewsForPlugins(pumpPlugins, MainApp.getSpecificPluginsVisibleInList(PluginType.PUMP)); - createViewsForPlugins(sensitivityPlugins, MainApp.getSpecificPluginsVisibleInListByInterface(SensitivityInterface.class, PluginType.SENSITIVITY)); - createViewsForPlugins(apsPlugins, MainApp.getSpecificPluginsVisibleInList(PluginType.APS)); - createViewsForPlugins(loopPlugins, MainApp.getSpecificPluginsVisibleInList(PluginType.LOOP)); - createViewsForPlugins(constraintsPlugins, MainApp.getSpecificPluginsVisibleInListByInterface(ConstraintsInterface.class, PluginType.CONSTRAINTS)); - createViewsForPlugins(treatmentsPlugins, MainApp.getSpecificPluginsVisibleInList(PluginType.TREATMENT)); - createViewsForPlugins(generalPlugins, MainApp.getSpecificPluginsVisibleInList(PluginType.GENERAL)); - } - - private void createViewsForPlugins(LinearLayout parent, List plugins) { - for (PluginBase plugin: plugins) { - PluginView pluginView = new PluginView(plugin); - parent.addView(pluginView.getBaseView()); - pluginViews.add(pluginView); + insulinDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(InsulinInterface.class, PluginType.INSULIN), PluginType.INSULIN); + insulinListView.setAdapter(insulinDataAdapter); + setListViewHeightBasedOnChildren(insulinListView); + bgsourceDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(BgSourceInterface.class, PluginType.BGSOURCE), PluginType.BGSOURCE); + bgsourceListView.setAdapter(bgsourceDataAdapter); + if (MainApp.getSpecificPluginsVisibleInList(PluginType.BGSOURCE).size() == 0) + bgsourceLabel.setVisibility(View.GONE); + setListViewHeightBasedOnChildren(bgsourceListView); + pumpDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginType.PUMP), PluginType.PUMP); + pumpListView.setAdapter(pumpDataAdapter); + if (MainApp.getSpecificPluginsVisibleInList(PluginType.PUMP).size() == 0 || Config.NSCLIENT || Config.G5UPLOADER) { + pumpLabel.setVisibility(View.GONE); + pumpListView.setVisibility(View.GONE); } + setListViewHeightBasedOnChildren(pumpListView); + loopDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginType.LOOP), PluginType.LOOP); + loopListView.setAdapter(loopDataAdapter); + setListViewHeightBasedOnChildren(loopListView); + if (MainApp.getSpecificPluginsVisibleInList(PluginType.LOOP).size() == 0) + loopLabel.setVisibility(View.GONE); + treatmentDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginType.TREATMENT), PluginType.TREATMENT); + treatmentsListView.setAdapter(treatmentDataAdapter); + setListViewHeightBasedOnChildren(treatmentsListView); + if (MainApp.getSpecificPluginsVisibleInList(PluginType.TREATMENT).size() == 0) + treatmentsLabel.setVisibility(View.GONE); + profileDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(ProfileInterface.class, PluginType.PROFILE), PluginType.PROFILE); + profileListView.setAdapter(profileDataAdapter); + if (MainApp.getSpecificPluginsVisibleInList(PluginType.PROFILE).size() == 0) + profileLabel.setVisibility(View.GONE); + setListViewHeightBasedOnChildren(profileListView); + apsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginType.APS), PluginType.APS); + apsListView.setAdapter(apsDataAdapter); + setListViewHeightBasedOnChildren(apsListView); + if (MainApp.getSpecificPluginsVisibleInList(PluginType.APS).size() == 0) + apsLabel.setVisibility(View.GONE); + sensivityDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(SensitivityInterface.class, PluginType.SENSITIVITY), PluginType.SENSITIVITY); + sensitivityListView.setAdapter(sensivityDataAdapter); + setListViewHeightBasedOnChildren(sensitivityListView); + constraintsDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInListByInterface(ConstraintsInterface.class, PluginType.CONSTRAINTS), PluginType.CONSTRAINTS); + constraintsListView.setAdapter(constraintsDataAdapter); + setListViewHeightBasedOnChildren(constraintsListView); + if (MainApp.getSpecificPluginsVisibleInList(PluginType.CONSTRAINTS).size() == 0) + constraintsLabel.setVisibility(View.GONE); + generalDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsVisibleInList(PluginType.GENERAL), PluginType.GENERAL); + generalListView.setAdapter(generalDataAdapter); + setListViewHeightBasedOnChildren(generalListView); } - private boolean areMultipleSelectionsAllowed(PluginType type) { - return type == PluginType.GENERAL || type == PluginType.CONSTRAINTS ||type == PluginType.LOOP; + /* + * ConfigBuilderFragment code + */ + + private class PluginCustomAdapter extends ArrayAdapter { + + private ArrayList pluginList; + final private PluginType type; + + PluginCustomAdapter(Context context, int textViewResourceId, + ArrayList pluginList, PluginType type) { + super(context, textViewResourceId, pluginList); + this.pluginList = new ArrayList<>(); + this.pluginList.addAll(pluginList); + this.type = type; + } + + private class PluginViewHolder { + TextView name; + CheckBox checkboxEnabled; + CheckBox checkboxVisible; + ImageView settings; + } + + @NonNull + @Override + public View getView(int position, View view, @NonNull ViewGroup parent) { + + PluginViewHolder holder; + PluginBase plugin = pluginList.get(position); + + if (view == null) { + view = LayoutInflater.from(parent.getContext()).inflate(R.layout.configbuilder_simpleitem, null); + + holder = new PluginViewHolder(); + holder.name = (TextView) view.findViewById(R.id.configbuilder_simpleitem_name); + holder.checkboxEnabled = (CheckBox) view.findViewById(R.id.configbuilder_simpleitem_checkboxenabled); + holder.checkboxVisible = (CheckBox) view.findViewById(R.id.configbuilder_simpleitem_checkboxvisible); + holder.settings = (ImageView) view.findViewById(R.id.configbuilder_simpleitem_settings); + + if (plugin.isEnabled(type) && plugin.getPreferencesId() != -1) + holder.settings.setVisibility(View.VISIBLE); + else + holder.settings.setVisibility(View.INVISIBLE); + + view.setTag(holder); + + holder.checkboxEnabled.setOnClickListener(v -> { + CheckBox cb = (CheckBox) v; + PluginBase plugin1 = (PluginBase) cb.getTag(); + plugin1.setPluginEnabled(type, cb.isChecked()); + plugin1.setFragmentVisible(type, cb.isChecked()); + onEnabledCategoryChanged(plugin1, type); + ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxEnabled"); + MainApp.bus().post(new EventRefreshGui()); + MainApp.bus().post(new EventConfigBuilderChange()); + ConfigBuilderPlugin.getPlugin().logPluginStatus(); + FabricPrivacy.getInstance().logCustom(new CustomEvent("ConfigurationChange")); + }); + + holder.checkboxVisible.setOnClickListener(v -> { + CheckBox cb = (CheckBox) v; + PluginBase plugin12 = (PluginBase) cb.getTag(); + plugin12.setFragmentVisible(type, cb.isChecked()); + ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxVisible"); + MainApp.bus().post(new EventRefreshGui()); + ConfigBuilderPlugin.getPlugin().logPluginStatus(); + }); + + holder.settings.setOnClickListener(v -> { + final PluginBase plugin13 = (PluginBase) v.getTag(); + PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", () -> { + Intent i = new Intent(getContext(), PreferencesActivity.class); + i.putExtra("id", plugin13.getPreferencesId()); + startActivity(i); + }, null); + }); + + holder.name.setOnLongClickListener(v -> { + final PluginBase plugin14 = (PluginBase) v.getTag(); + PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", () -> { + Intent i = new Intent(getContext(), PreferencesActivity.class); + i.putExtra("id", plugin14.getPreferencesId()); + startActivity(i); + }, null); + return false; + }); + + } else { + holder = (PluginViewHolder) view.getTag(); + } + + holder.name.setText(plugin.getName()); + holder.checkboxEnabled.setChecked(plugin.isEnabled(type)); + holder.checkboxVisible.setChecked(plugin.isFragmentVisible()); + holder.name.setTag(plugin); + holder.checkboxEnabled.setTag(plugin); + holder.checkboxVisible.setTag(plugin); + holder.settings.setTag(plugin); + + if (plugin.pluginDescription.alwaysEnabled) { + holder.checkboxEnabled.setEnabled(false); + } + + if (plugin.pluginDescription.alwayVisible) { + holder.checkboxEnabled.setEnabled(false); + } + + if (!plugin.isEnabled(type)) { + holder.checkboxVisible.setEnabled(false); + } + + if (!plugin.hasFragment()) { + holder.checkboxVisible.setVisibility(View.INVISIBLE); + } + + // Hide enabled control and force enabled plugin if there is only one plugin available + if (type == PluginType.INSULIN || type == PluginType.PUMP || type == PluginType.SENSITIVITY) + if (pluginList.size() < 2) { + holder.checkboxEnabled.setEnabled(false); + plugin.setPluginEnabled(type, true); + ConfigBuilderPlugin.getPlugin().storeSettings("ForceEnable"); + } + + // Constraints cannot be disabled + if (type == PluginType.CONSTRAINTS) + holder.checkboxEnabled.setEnabled(false); + + // Hide disabled profiles by default + if (type == PluginType.PROFILE) { + if (!plugin.isEnabled(type)) { + holder.checkboxVisible.setEnabled(false); + holder.checkboxVisible.setChecked(false); + } else { + holder.checkboxVisible.setEnabled(true); + } + } + + // Disable profile control for pump profiles if pump is not enabled + if (type == PluginType.PROFILE) { + if (PumpInterface.class.isAssignableFrom(plugin.getClass())) { + if (!plugin.isEnabled(PluginType.PUMP)) { + holder.checkboxEnabled.setEnabled(false); + holder.checkboxEnabled.setChecked(false); + } + } + } + + if (plugin.isEnabled(type)) { + view.setBackgroundColor(MainApp.gc(R.color.configBuilderSelectedBackground)); + } + + return view; + + } + } public static void processOnEnabledCategoryChanged(PluginBase changedPlugin, PluginType type) { @@ -200,90 +394,35 @@ public class ConfigBuilderFragment extends SubscriberFragment { } } - class PluginView { + void onEnabledCategoryChanged(PluginBase changedPlugin, PluginType type) { + processOnEnabledCategoryChanged(changedPlugin, type); + updateGUI(); + } - private Unbinder unbinder; - private PluginBase plugin; + /**** + * Method for Setting the Height of the ListView dynamically. + * *** Hack to fix the issue of not showing all the items of the ListView + * *** when placed inside a ScrollView + ****/ + public static void setListViewHeightBasedOnChildren(ListView listView) { + ListAdapter listAdapter = listView.getAdapter(); + if (listAdapter == null) + return; - LinearLayout baseView; - @BindView(R.id.plugin_enabled_exclusive) - RadioButton enabledExclusive; - @BindView(R.id.plugin_enabled_inclusive) - CheckBox enabledInclusive; - @BindView(R.id.plugin_name) - TextView pluginName; - @BindView(R.id.plugin_description) - TextView pluginDescription; - @BindView(R.id.plugin_preferences) - ImageButton pluginPreferences; - @BindView(R.id.plugin_visibility) - CheckBox pluginVisibility; + int desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(), View.MeasureSpec.UNSPECIFIED); + int totalHeight = 0; + View view = null; + for (int i = 0; i < listAdapter.getCount(); i++) { + view = listAdapter.getView(i, view, listView); + if (i == 0) + view.setLayoutParams(new ViewGroup.LayoutParams(desiredWidth, ViewGroup.LayoutParams.WRAP_CONTENT)); - public PluginView(PluginBase plugin) { - this.plugin = plugin; - baseView = (LinearLayout) getLayoutInflater().inflate(R.layout.configbuilder_single_plugin, null); - unbinder = ButterKnife.bind(this, baseView); - update(); + view.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED); + totalHeight += view.getMeasuredHeight(); } - - public LinearLayout getBaseView() { - return baseView; - } - - public void update() { - enabledExclusive.setVisibility(areMultipleSelectionsAllowed(plugin.getType()) ? View.GONE : View.VISIBLE); - enabledInclusive.setVisibility(areMultipleSelectionsAllowed(plugin.getType()) ? View.VISIBLE : View.GONE); - enabledExclusive.setChecked(plugin.isEnabled(plugin.getType())); - enabledInclusive.setChecked(plugin.isEnabled(plugin.getType())); - enabledInclusive.setEnabled(!plugin.pluginDescription.alwaysEnabled); - enabledExclusive.setEnabled(!plugin.pluginDescription.alwaysEnabled); - pluginName.setText(plugin.getName()); - if (plugin.getDescription() == null) pluginDescription.setVisibility(View.GONE); - else { - pluginDescription.setVisibility(View.VISIBLE); - pluginDescription.setText(plugin.getDescription()); - } - pluginPreferences.setVisibility(plugin.getPreferencesId() == -1 || !plugin.isEnabled(plugin.getType()) ? View.INVISIBLE : View.VISIBLE); - pluginVisibility.setVisibility(plugin.hasFragment() ? View.VISIBLE : View.INVISIBLE); - pluginVisibility.setEnabled(!(plugin.pluginDescription.neverVisible || plugin.pluginDescription.alwayVisible) && plugin.isEnabled(plugin.getType())); - pluginVisibility.setChecked(plugin.isFragmentVisible()); - } - - @OnClick(R.id.plugin_visibility) - void onVisibilityChanged() { - plugin.setFragmentVisible(plugin.getType(), pluginVisibility.isChecked()); - ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxVisible"); - MainApp.bus().post(new EventRefreshGui()); - ConfigBuilderPlugin.getPlugin().logPluginStatus(); - } - - @OnClick({R.id.plugin_enabled_exclusive, R.id.plugin_enabled_inclusive}) - void onEnabledChanged() { - boolean enabled = enabledExclusive.getVisibility() == View.VISIBLE ? enabledExclusive.isChecked() : enabledInclusive.isChecked(); - plugin.setPluginEnabled(plugin.getType(), enabled); - plugin.setFragmentVisible(plugin.getType(), enabled); - processOnEnabledCategoryChanged(plugin, plugin.getType()); - updateGUI(); - ConfigBuilderPlugin.getPlugin().storeSettings("CheckedCheckboxEnabled"); - MainApp.bus().post(new EventRefreshGui()); - MainApp.bus().post(new EventConfigBuilderChange()); - ConfigBuilderPlugin.getPlugin().logPluginStatus(); - FabricPrivacy.getInstance().logCustom(new CustomEvent("ConfigurationChange")); - } - - @OnClick(R.id.plugin_preferences) - void onPluginPreferencesClicked() { - PasswordProtection.QueryPassword(getContext(), R.string.settings_password, "settings_password", () -> { - Intent i = new Intent(getContext(), PreferencesActivity.class); - i.putExtra("id", plugin.getPreferencesId()); - startActivity(i); - }, null); - } - - public void unbind() { - unbinder.unbind(); - } - + ViewGroup.LayoutParams params = listView.getLayoutParams(); + params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1)); + listView.setLayoutParams(params); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index 1911f588b1..04e7dcdbfd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -92,7 +92,6 @@ public class ConfigBuilderPlugin extends PluginBase { .alwayVisible(false) .pluginName(R.string.configbuilder) .shortName(R.string.configbuilder_shortname) - .description(R.string.description_config_builder) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java index 010bb1277a..293029b80f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesPlugin.java @@ -56,7 +56,6 @@ public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface .showInList(!Config.NSCLIENT && !Config.G5UPLOADER) .pluginName(R.string.objectives) .shortName(R.string.objectives_shortname) - .description(R.string.description_objectives) ); initializeData(); loadProgress(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Food/FoodPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Food/FoodPlugin.java index 84996f1a37..14eb318af4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Food/FoodPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Food/FoodPlugin.java @@ -26,7 +26,6 @@ public class FoodPlugin extends PluginBase { .fragmentClass(FoodFragment.class.getName()) .pluginName(R.string.food) .shortName(R.string.food_short) - .description(R.string.description_food) ); this.service = new FoodService(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefBasePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefBasePlugin.java index 5d4d1187ac..2c46cd7bb6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefBasePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefBasePlugin.java @@ -29,7 +29,6 @@ public abstract class InsulinOrefBasePlugin extends PluginBase implements Insuli .fragmentClass(InsulinFragment.class.getName()) .pluginName(R.string.fastactinginsulin) .shortName(R.string.insulin_shortname) - .visibleByDefault(false) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefFreePeakPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefFreePeakPlugin.java index c1fc44438f..a710f742a7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefFreePeakPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefFreePeakPlugin.java @@ -24,8 +24,7 @@ public class InsulinOrefFreePeakPlugin extends InsulinOrefBasePlugin { super(); pluginDescription .pluginName(R.string.free_peak_oref) - .preferencesId(R.xml.pref_insulinoreffreepeak) - .description(R.string.description_insulin_free_peak); + .preferencesId(R.xml.pref_insulinoreffreepeak); } @Override diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefRapidActingPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefRapidActingPlugin.java index c275aef3fd..a8f9761771 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefRapidActingPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefRapidActingPlugin.java @@ -22,8 +22,7 @@ public class InsulinOrefRapidActingPlugin extends InsulinOrefBasePlugin { private InsulinOrefRapidActingPlugin() { super(); pluginDescription - .pluginName(R.string.rapid_acting_oref) - .description(R.string.description_insulin_rapid); + .pluginName(R.string.rapid_acting_oref); } @Override diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefUltraRapidActingPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefUltraRapidActingPlugin.java index 94e5910470..ba5fc99011 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefUltraRapidActingPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Insulin/InsulinOrefUltraRapidActingPlugin.java @@ -22,8 +22,7 @@ public class InsulinOrefUltraRapidActingPlugin extends InsulinOrefBasePlugin { private InsulinOrefUltraRapidActingPlugin() { super(); pluginDescription - .pluginName(R.string.ultrarapid_oref) - .description(R.string.description_insulin_ultra_rapid); + .pluginName(R.string.ultrarapid_oref); } @Override diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java index c01cf0a641..f6ec0ff7ab 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java @@ -94,7 +94,6 @@ public class LoopPlugin extends PluginBase { .pluginName(R.string.loop) .shortName(R.string.loop_shortname) .preferencesId(R.xml.pref_closedmode) - .description(R.string.description_loop) ); loopSuspendedTill = SP.getLong("loopSuspendedTill", 0L); isSuperBolus = SP.getBoolean("isSuperBolus", false); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientPlugin.java index 6949cdc8b1..c43297ccf6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientPlugin.java @@ -69,7 +69,6 @@ public class NSClientPlugin extends PluginBase { .pluginName(R.string.nsclientinternal) .shortName(R.string.nsclientinternal_shortname) .preferencesId(R.xml.pref_nsclientinternal) - .description(R.string.description_ns_client) ); if (Config.NSCLIENT || Config.G5UPLOADER) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java index b6e07bb004..143456f6fc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java @@ -62,7 +62,6 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface { .pluginName(R.string.openapsama) .shortName(R.string.oaps_shortname) .preferencesId(R.xml.pref_openapsama) - .description(R.string.description_ama) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java index 39d05f8ffb..14dac65625 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java @@ -62,7 +62,6 @@ public class OpenAPSMAPlugin extends PluginBase implements APSInterface { .pluginName(R.string.openapsma) .shortName(R.string.oaps_shortname) .preferencesId(R.xml.pref_openapsma) - .description(R.string.description_ma) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java index f28a6eff8e..49a81ea612 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/OpenAPSSMBPlugin.java @@ -65,7 +65,6 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface { .pluginName(R.string.openapssmb) .shortName(R.string.smb_shortname) .preferencesId(R.xml.pref_openapssmb) - .description(R.string.description_smb) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java index 303ca10949..c38f41b825 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java @@ -315,7 +315,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com confirmMessage += "
" + MainApp.gs(R.string.carbs) + ": " + "" + carbsAfterConstraints + "g" + ""; if (insulinAfterConstraints - calculatedTotalInsulin != 0 || !carbsAfterConstraints.equals(calculatedCarbs)) { - okClicked = false; AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(MainApp.gs(R.string.treatmentdeliveryerror)); builder.setMessage(MainApp.gs(R.string.constraints_violation) + "\n" + MainApp.gs(R.string.changeyourinput)); @@ -409,9 +408,9 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com private void initDialog() { Profile profile = MainApp.getConfigBuilder().getProfile(); - ProfileStore profileStore = MainApp.getConfigBuilder().getActiveProfileInterface() != null ? MainApp.getConfigBuilder().getActiveProfileInterface().getProfile() : null; + ProfileStore profileStore = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile(); - if (profile == null || profileStore == null) { + if (profile == null) { ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.noprofile)); dismiss(); return; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index fadb30420c..31aa098579 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -672,15 +672,12 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, private void onClickAcceptTemp() { Profile profile = MainApp.getConfigBuilder().getProfile(); - Context context = getContext(); - - if (context == null) return; if (LoopPlugin.getPlugin().isEnabled(PluginType.LOOP) && profile != null) { LoopPlugin.getPlugin().invoke("Accept temp button", false); final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun; if (finalLastRun != null && finalLastRun.lastAPSRun != null && finalLastRun.constraintsProcessed.isChangeRequested()) { - AlertDialog.Builder builder = new AlertDialog.Builder(context); + AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setTitle(MainApp.gs(R.string.confirmation)); builder.setMessage(MainApp.gs(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed); builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java index 3b787fd768..67e494a76d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewPlugin.java @@ -50,7 +50,6 @@ public class OverviewPlugin extends PluginBase { .pluginName(R.string.overview) .shortName(R.string.overview_shortname) .preferencesId(R.xml.pref_overview) - .description(R.string.description_overview) ); String storedData = SP.getString("QuickWizard", "[]"); try { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java index 5f6d50273a..ed57652d1f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java @@ -57,7 +57,6 @@ public class PersistentNotificationPlugin extends PluginBase { .neverVisible(true) .pluginName(R.string.ongoingnotificaction) .enableByDefault(true) - .description(R.string.description_persistent_notification) ); this.ctx = ctx; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java index 8d4e2d6a36..95cfd60c99 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfilePlugin.java @@ -64,7 +64,6 @@ public class LocalProfilePlugin extends PluginBase implements ProfileInterface { .fragmentClass(LocalProfileFragment.class.getName()) .pluginName(R.string.localprofile) .shortName(R.string.localprofile_shortname) - .description(R.string.description_profile_local) ); loadSettings(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java index 404aff0608..3a66d57dad 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfilePlugin.java @@ -49,7 +49,6 @@ public class NSProfilePlugin extends PluginBase implements ProfileInterface { .alwaysEnabled(Config.NSCLIENT) .alwayVisible(Config.NSCLIENT) .showInList(!Config.NSCLIENT) - .description(R.string.description_profile_nightscout) ); loadNSProfile(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java index bb669289ee..b321faca50 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfilePlugin.java @@ -52,7 +52,6 @@ public class SimpleProfilePlugin extends PluginBase implements ProfileInterface .fragmentClass(SimpleProfileFragment.class.getName()) .pluginName(R.string.simpleprofile) .shortName(R.string.simpleprofile_shortname) - .description(R.string.description_profile_simple) ); loadSettings(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index b1f2b076ae..eb06d4055d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -167,7 +167,6 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint .fragmentClass(ComboFragment.class.getName()) .pluginName(R.string.combopump) .shortName(R.string.combopump_shortname) - .description(R.string.description_pump_combo) ); ruffyScripter = new RuffyScripter(MainApp.instance().getApplicationContext()); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java index 1f51979126..903be558b9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java @@ -59,7 +59,6 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte .pluginName(R.string.danarspump) .shortName(R.string.danarpump_shortname) .preferencesId(R.xml.pref_danars) - .description(R.string.description_pump_dana_r) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java index 8d18ca4f04..b37d0e945f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java @@ -162,24 +162,19 @@ public class DanaRFragment extends SubscriberFragment { activity.runOnUiThread( new Runnable() { @Override - public void run() { - synchronized(DanaRFragment.this){ + public void run() { + if (c.sStatus == EventPumpStatusChanged.CONNECTING) + btConnectionView.setText("{fa-bluetooth-b spin} " + c.sSecondsElapsed + "s"); + else if (c.sStatus == EventPumpStatusChanged.CONNECTED) + btConnectionView.setText("{fa-bluetooth}"); + else if (c.sStatus == EventPumpStatusChanged.DISCONNECTED) + btConnectionView.setText("{fa-bluetooth-b}"); - if(btConnectionView == null || pumpStatusView == null || pumpStatusLayout == null ) return; - - if (c.sStatus == EventPumpStatusChanged.CONNECTING) - btConnectionView.setText("{fa-bluetooth-b spin} " + c.sSecondsElapsed + "s"); - else if (c.sStatus == EventPumpStatusChanged.CONNECTED) - btConnectionView.setText("{fa-bluetooth}"); - else if (c.sStatus == EventPumpStatusChanged.DISCONNECTED) - btConnectionView.setText("{fa-bluetooth-b}"); - - if (!status.equals("")) { - pumpStatusView.setText(status); - pumpStatusLayout.setVisibility(View.VISIBLE); - } else { - pumpStatusLayout.setVisibility(View.GONE); - } + if (!status.equals("")) { + pumpStatusView.setText(status); + pumpStatusLayout.setVisibility(View.VISIBLE); + } else { + pumpStatusLayout.setVisibility(View.GONE); } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java index b1b0f3d9ce..69c07ce706 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java @@ -382,6 +382,6 @@ public class DanaRPlugin extends AbstractDanaRPlugin { @Override public PumpEnactResult setUserOptions() { - return sExecutionService.setUserOptions(); + return null; } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/activities/DanaRUserOptionsActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/activities/DanaRUserOptionsActivity.java index 4a670a7e81..b7b7a793f4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/activities/DanaRUserOptionsActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/activities/DanaRUserOptionsActivity.java @@ -1,6 +1,7 @@ package info.nightscout.androidaps.plugins.PumpDanaR.activities; import android.app.Activity; +import android.content.Intent; import android.os.Bundle; import android.widget.Button; import android.widget.RadioButton; @@ -19,10 +20,13 @@ import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.interfaces.PluginType; +import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; +import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin; import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin; +import info.nightscout.androidaps.queue.Callback; import info.nightscout.utils.NumberPicker; /** @@ -79,6 +83,9 @@ public class DanaRUserOptionsActivity extends Activity { saveToPumpButton.setOnClickListener(v -> onSaveClick()); + boolean isv2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class) != null && MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginType.PUMP); + + DanaRPump pump = DanaRPump.getInstance(); //used for debugging log.debug("UserOptionsLoaded:" + (System.currentTimeMillis() - pump.lastConnection) / 1000 + " s ago" @@ -89,6 +96,20 @@ public class DanaRUserOptionsActivity extends Activity { + "\nbacklight:" + pump.backlightOnTimeSec + "\npumpUnits:" + pump.units + "\nlowReservoir:" + pump.lowReservoirRate); + log.debug("isV2:"+isv2); + if(isv2 && pump.lowReservoirRate < 10){ + log.debug("No user settings loaded forcing reload!"); + DanaRv2Plugin.getPlugin().getUserOptions(); + log.debug("UserOptionsLoaded:" + (System.currentTimeMillis() - pump.lastConnection) / 1000 + " s ago" + + "\ntimeDisplayType:" + pump.timeDisplayType + + "\nbuttonScroll:" + pump.buttonScrollOnOff + + "\ntimeDisplayType:" + pump.timeDisplayType + + "\nlcdOnTimeSec:" + pump.lcdOnTimeSec + + "\nbacklight:" + pump.backlightOnTimeSec + + "\npumpUnits:" + pump.units + + "\nlowReservoir:" + pump.lowReservoirRate); + + } screenTimeout.setParams((double) pump.lcdOnTimeSec, 5d, 240d, 5d, new DecimalFormat("1"), false); backlightTimeout.setParams((double) pump.backlightOnTimeSec, 1d, 60d, 1d, new DecimalFormat("1"), false); @@ -143,6 +164,9 @@ public class DanaRUserOptionsActivity extends Activity { //exit if pump is not DanaRS, Dana!, or DanaR with upgraded firmware return; } + if (isDanaRv2) { + DanaRv2Plugin.getPlugin().getUserOptions(); + } DanaRPump pump = DanaRPump.getInstance(); if (timeFormat.isChecked()) @@ -181,7 +205,11 @@ public class DanaRUserOptionsActivity extends Activity { } else pump.lowReservoirRate = 10; - MainApp.getConfigBuilder().getCommandQueue().setUserOptions(null); + if (isDanaRv2) { + DanaRv2Plugin.getPlugin().setUserOptions(); + } + + MainApp.getConfigBuilder().getCommandQueue().setUserSettings(null); finish(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MessageHashTable.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MessageHashTable.java index 4b90b8f02d..2d15d8236f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MessageHashTable.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MessageHashTable.java @@ -56,11 +56,11 @@ public class MessageHashTable { put(new MsgSettingGlucose()); // 0x3209 CMD_SETTING_V_GLUCOSEandEASY put(new MsgSettingPumpTime()); // 0x320A CMD_SETTING_V_TIME_I put(new MsgSettingUserOptions()); // 0x320B CMD_SETTING_V_USER_OPTIONS + put(new MsgGetUserOptions()); // 0x320B CMD_SETTING_V_USER_OPTIONS - trying to get uptions put(new MsgSettingActiveProfile()); // 0x320C CMD_SETTING_V_PROFILE_NUMBER put(new MsgSettingProfileRatiosAll()); // 0x320D CMD_SETTING_V_CIR_CF_VALUE put(new MsgSetSingleBasalProfile()); // 0x3302 CMD_SETTING_BASAL_INS_S put(new MsgSetBasalProfile()); // 0x3306 CMD_SETTING_BASAL_PROFILE_S - put(new MsgSetUserOptions()); // 0x330B CMD_SETTING_USER_OPTIONS_S put(new MsgSetActivateBasalProfile()); // 0x330C CMD_SETTING_PROFILE_NUMBER_S put(new MsgHistoryAllDone()); // 0x41F1 CMD_HISTORY_ALL_DONE put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgSetUserOptions.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgSetUserOptions.java deleted file mode 100644 index 5cdf2d75fa..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgSetUserOptions.java +++ /dev/null @@ -1,58 +0,0 @@ -package info.nightscout.androidaps.plugins.PumpDanaR.comm; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import info.nightscout.androidaps.Config; -import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; - -/** - * Created by mike on 05.07.2016. - */ -public class MsgSetUserOptions extends MessageBase { - - public boolean done; - - public MsgSetUserOptions() { - SetCommand(0x330B); - - DanaRPump pump = DanaRPump.getInstance(); - - log.debug(" initializing MsgSetUserOptions"); - log.debug("timeDisplayType: " + (byte) pump.timeDisplayType); - log.debug("Button scroll: " + (byte) pump.buttonScrollOnOff); - log.debug("BeepAndAlarm: " + (byte) pump.beepAndAlarm); - log.debug("screen timeout: " + (byte) pump.lcdOnTimeSec); - log.debug("Backlight: " + (byte) pump.backlightOnTimeSec); - log.debug("Selected language: " + (byte) pump.selectedLanguage); - log.debug("Units: " + (byte) pump.units); - log.debug("Shutdown: " + (byte) pump.shutdownHour); - log.debug("Low reservoir: " + (byte) pump.lowReservoirRate); - // need to organize here - // glucoseunit is at pos 8 and lowReservoirRate is at pos 27 - AddParamByte((byte) pump.timeDisplayType); - AddParamByte((byte) pump.buttonScrollOnOff); - AddParamByte((byte) pump.beepAndAlarm); - AddParamByte((byte) pump.lcdOnTimeSec); - AddParamByte((byte) pump.backlightOnTimeSec); - AddParamByte((byte) pump.selectedLanguage); - AddParamByte((byte) pump.units); - AddParamByte((byte) pump.shutdownHour); - AddParamByte((byte) pump.lowReservoirRate); - } - - private static Logger log = LoggerFactory.getLogger(MsgSetUserOptions.class); - - public void handleMessage(byte[] bytes) { - log.debug("Entering handleMessage "); - int result = intFromBuff(bytes, 0, 1); - if (result != 1) { - failed = true; - log.debug("Setting user options: " + result + " FAILED!!!"); - } else { - if (Config.logDanaMessageDetail) - log.debug("Setting user options: " + result); - } - } - -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgSettingUserOptions.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgSettingUserOptions.java index 51c37b1217..f7fa834879 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgSettingUserOptions.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgSettingUserOptions.java @@ -4,12 +4,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import android.support.v4.internal.view.SupportMenu; -import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; +import info.nightscout.androidaps.Config; /** - * Created by Rumen Georgiev on 6/11/2018. + * Created by mike on 05.07.2016. */ -<<<<<<< HEAD public class MsgSettingUserOptions extends MessageBase { private int backlightOnTimeSec; @@ -64,10 +63,6 @@ public class MsgSettingUserOptions extends MessageBase { // 6 extended bolus on/off // 10 missed bolus } -======= - -public class MsgSettingUserOptions extends MessageBase { ->>>>>>> upstream/rsoption private static Logger log = LoggerFactory.getLogger(MsgSettingUserOptions.class); @@ -75,7 +70,6 @@ public class MsgSettingUserOptions extends MessageBase { SetCommand(0x320B); } -<<<<<<< HEAD public void handleMessage(byte[] bytes) { log.debug("Entering handleMessage "); newOptions = new byte[]{bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], bytes[8], bytes[9], bytes[15], bytes[16], bytes[17], bytes[18], bytes[19], bytes[20], bytes[21], bytes[22], bytes[23], bytes[24], bytes[25], bytes[26], bytes[27], bytes[28], bytes[29], bytes[30], bytes[31], bytes[32]}; @@ -86,52 +80,8 @@ public class MsgSettingUserOptions extends MessageBase { } else { if (Config.logDanaMessageDetail) log.debug("Setting user options: " + result); -======= - public void handleMessage(byte[] packet) { - DanaRPump pump = DanaRPump.getInstance(); - byte[] bytes = getDataBytes(packet, 0, packet.length - 10); - for(int pos=0; pos < bytes.length; pos++) { - log.debug("[" + pos + "]" + bytes[pos]); ->>>>>>> upstream/rsoption } - pump.timeDisplayType = bytes[0] == (byte) 1 ? 0 : 1; // 1 -> 24h 0 -> 12h - pump.buttonScrollOnOff = bytes[1] == (byte) 1 ? 1 : 0; // 1 -> ON, 0-> OFF - pump.beepAndAlarm = bytes[2]; // 1 -> Sound on alarm 2-> Vibrate on alarm 3-> Both on alarm 5-> Sound + beep 6-> vibrate + beep 7-> both + beep Beep adds 4 - pump.lcdOnTimeSec = bytes[3] & 255; - pump.backlightOnTimeSec = bytes[4] & 255; - pump.selectedLanguage = bytes[5]; // on DanaRv2 is that needed ? - pump.units = bytes[8]; - pump.shutdownHour = bytes[9]; - pump.lowReservoirRate = bytes[32] & 255; - /* int selectableLanguage1 = bytes[10]; - int selectableLanguage2 = bytes[11]; - int selectableLanguage3 = bytes[12]; - int selectableLanguage4 = bytes[13]; - int selectableLanguage5 = bytes[14]; - */ - -// if (Config.logDanaMessageDetail) { - - log.debug("timeDisplayType: " + pump.timeDisplayType); - log.debug("Button scroll: " + pump.buttonScrollOnOff); - log.debug("BeepAndAlarm: " + pump.beepAndAlarm); - log.debug("screen timeout: " + pump.lcdOnTimeSec); - log.debug("Backlight: " + pump.backlightOnTimeSec); - log.debug("Selected language: " + pump.selectedLanguage); - log.debug("Units: " + pump.getUnits()); - log.debug("Shutdown: " + pump.shutdownHour); - log.debug("Low reservoir: " + pump.lowReservoirRate); -// } } - public static byte[] getDataBytes(byte[] bytes, int start, int len) { - if (bytes == null) { - return null; - } - byte[] ret = new byte[len]; - System.arraycopy(bytes, start + 6, ret, 0, len); - return ret; - } -<<<<<<< HEAD public byte[] getCommByte(int cmd, byte[] data) { int len = (data == null ? 0 : data.length) + 3; @@ -178,6 +128,4 @@ public class MsgSettingUserOptions extends MessageBase { return (li_crc ^ (((li_crc & 255) << 4) << 1)) & SupportMenu.USER_MASK; } -======= ->>>>>>> upstream/rsoption } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/AbstractDanaRExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/AbstractDanaRExecutionService.java index e4c2933d43..17db916dae 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/AbstractDanaRExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/AbstractDanaRExecutionService.java @@ -92,7 +92,6 @@ public abstract class AbstractDanaRExecutionService extends Service { public abstract boolean extendedBolusStop(); - public abstract PumpEnactResult setUserOptions(); protected BroadcastReceiver receiver = new BroadcastReceiver() { @Override diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java index 7976430b77..de7eeb1591 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java @@ -18,8 +18,8 @@ import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; +import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgGetUserOptions; import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingUserOptions; -import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetUserOptions; import info.nightscout.androidaps.plugins.Treatments.Treatment; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventInitializationChanged; @@ -64,6 +64,7 @@ import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus; import info.nightscout.androidaps.queue.Callback; import info.nightscout.utils.NSUpload; import info.nightscout.utils.SP; +import info.nightscout.utils.ToastUtils; public class DanaRExecutionService extends AbstractDanaRExecutionService{ @@ -178,7 +179,6 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{ mSerialIOThread.sendMessage(new MsgSettingActiveProfile()); mSerialIOThread.sendMessage(new MsgSettingProfileRatios()); mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll()); - mSerialIOThread.sendMessage(new MsgSettingUserOptions()); MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime))); mSerialIOThread.sendMessage(new MsgSettingPumpTime()); long timeDiff = (mDanaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L; @@ -384,6 +384,30 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{ return true; } + public PumpEnactResult getUserOptions() { + if (!isConnected()) + return new PumpEnactResult().success(false); + DanaRPump pump = DanaRPump.getInstance(); + MsgGetUserOptions msg = new MsgGetUserOptions(); + mDanaRPump.lastConnection = System.currentTimeMillis(); + return new PumpEnactResult().success(true); + } + + public PumpEnactResult updateUserOptions() { + if (!isConnected()) + return new PumpEnactResult().success(false); + DanaRPump pump = DanaRPump.getInstance(); + MsgSettingUserOptions msg = new MsgSettingUserOptions(pump.timeDisplayType, pump.buttonScrollOnOff, pump.beepAndAlarm, pump.lcdOnTimeSec, pump.backlightOnTimeSec, pump.selectedLanguage, pump.units, pump.shutdownHour, pump.lowReservoirRate, 0, 0); + + mSerialIOThread.sendMessage(msg); + while (!msg.done && mRfcommSocket.isConnected()) { + SystemClock.sleep(100); + } + SystemClock.sleep(200); + mDanaRPump.lastConnection = System.currentTimeMillis(); + return new PumpEnactResult().success(true); + } + @Subscribe public void onStatusEvent(EventAppExit event) { if (Config.logFunctionCalls) @@ -399,13 +423,4 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{ log.debug("EventAppExit finished"); } - public PumpEnactResult setUserOptions() { - if (!isConnected()) - return new PumpEnactResult().success(false); - SystemClock.sleep(300); - MsgSetUserOptions msg = new MsgSetUserOptions(); - mSerialIOThread.sendMessage(msg); - SystemClock.sleep(200); - return new PumpEnactResult().success(!msg.failed); - } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java index 7854426b5d..e46e3d6caf 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java @@ -327,9 +327,4 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService { return true; } - @Override - public PumpEnactResult setUserOptions() { - return null; - } - } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java index b6d9d1721e..3457564cfb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java @@ -83,7 +83,6 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte .pluginName(R.string.danarspump) .shortName(R.string.danarspump_shortname) .preferencesId(R.xml.pref_danars) - .description(R.string.description_pump_dana_rs) ); pumpDescription.isBolusCapable = true; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java index 517fb914c7..87b02c60ae 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java @@ -391,11 +391,14 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { @Override public PumpEnactResult setUserOptions() { -<<<<<<< HEAD DanaRv2ExecutionService service = new DanaRv2ExecutionService(); return service.setUserOptions(); -======= - return sExecutionService.setUserOptions(); ->>>>>>> upstream/rsoption } + + public PumpEnactResult getUserOptions() { + DanaRv2ExecutionService service = new DanaRv2ExecutionService(); + log.debug("MsgGetUserOptions executed!"); + return service.getUserOptions(); + } + } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MessageHashTable_v2.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MessageHashTable_v2.java index 8d1cd12be1..cafba32239 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MessageHashTable_v2.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MessageHashTable_v2.java @@ -66,7 +66,6 @@ public class MessageHashTable_v2 { put(new MsgSettingProfileRatiosAll()); // 0x320D CMD_SETTING_V_CIR_CF_VALUE put(new MsgSetSingleBasalProfile()); // 0x3302 CMD_SETTING_BASAL_INS_S put(new MsgSetBasalProfile()); // 0x3306 CMD_SETTING_BASAL_PROFILE_S - put(new MsgSetUserOptions()); // 0x330B CMD_SETTING_USER_OPTIONS_S put(new MsgSetActivateBasalProfile()); // 0x330C CMD_SETTING_PROFILE_NUMBER_S put(new MsgHistoryAllDone()); // 0x41F1 CMD_HISTORY_ALL_DONE put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java index a76856996b..0927baa49b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java @@ -18,8 +18,8 @@ import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; +import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgGetUserOptions; import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingUserOptions; -import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetUserOptions; import info.nightscout.androidaps.plugins.Treatments.Treatment; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventInitializationChanged; @@ -70,6 +70,7 @@ import info.nightscout.utils.DateUtil; import info.nightscout.utils.NSUpload; import info.nightscout.utils.SP; import info.nightscout.utils.T; +import info.nightscout.utils.ToastUtils; public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { @@ -200,12 +201,8 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { mSerialIOThread.sendMessage(new MsgSettingGlucose()); mSerialIOThread.sendMessage(new MsgSettingActiveProfile()); mSerialIOThread.sendMessage(new MsgSettingProfileRatios()); -<<<<<<< HEAD //added by Roumen for testing and mSerialIOThread.sendMessage(new MsgGetUserOptions()); -======= - mSerialIOThread.sendMessage(new MsgSettingUserOptions()); ->>>>>>> upstream/rsoption mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll()); MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime))); mSerialIOThread.sendMessage(new MsgSettingPumpTime()); @@ -480,22 +477,26 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { } public PumpEnactResult setUserOptions() { -<<<<<<< HEAD if (!isConnected()) { return new PumpEnactResult().success(false); } -======= - if (!isConnected()) - return new PumpEnactResult().success(false); ->>>>>>> upstream/rsoption SystemClock.sleep(300); - MsgSetUserOptions msg = new MsgSetUserOptions(); + DanaRPump pump = DanaRPump.getInstance(); + MsgSettingUserOptions msg = new MsgSettingUserOptions(pump.timeDisplayType, pump.buttonScrollOnOff, pump.beepAndAlarm, pump.lcdOnTimeSec, pump.backlightOnTimeSec, pump.selectedLanguage, pump.units, pump.shutdownHour, pump.lowReservoirRate, 0, 0); + if (mSerialIOThread != null) { + mSerialIOThread.disconnect("MsgSetUserOptions - Recreate SerialIOThread"); + } + mSerialIOThread = new SerialIOThread(mRfcommSocket); + MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.CONNECTED, 0)); mSerialIOThread.sendMessage(msg); + while (!msg.done && mRfcommSocket.isConnected()) { + SystemClock.sleep(100); + } SystemClock.sleep(200); - return new PumpEnactResult().success(!msg.failed); + mDanaRPump.lastConnection = System.currentTimeMillis(); + return new PumpEnactResult().success(true); } -<<<<<<< HEAD public PumpEnactResult getUserOptions() { if (!isConnected()) { return new PumpEnactResult().success(false); @@ -505,6 +506,4 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { mDanaRPump.lastConnection = System.currentTimeMillis(); return new PumpEnactResult().success(true); } -======= ->>>>>>> upstream/rsoption } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java index 9fb98d3175..b99b8ec908 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/InsightPlugin.java @@ -112,7 +112,6 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai .pluginName(R.string.insightpump) .shortName(R.string.insightpump_shortname) .preferencesId(R.xml.pref_insightpump) - .description(R.string.description_pump_insight) ); log("InsightPlugin instantiated"); pumpDescription.isBolusCapable = true; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java index 09cff7d97e..fed0c01c64 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java @@ -42,7 +42,6 @@ public class MDIPlugin extends PluginBase implements PumpInterface { super(new PluginDescription() .mainType(PluginType.PUMP) .pluginName(R.string.mdi) - .description(R.string.description_pump_mdi) ); pumpDescription.isBolusCapable = true; pumpDescription.bolusStep = 0.5d; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java index 653ab66c21..34d3fee80b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java @@ -77,8 +77,6 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface { .pluginName(R.string.virtualpump) .shortName(R.string.virtualpump_shortname) .preferencesId(R.xml.pref_virtualpump) - .neverVisible(BuildConfig.NSCLIENTOLNY || BuildConfig.G5UPLOADER) - .description(R.string.description_pump_virtual) ); pumpDescription.isBolusCapable = true; pumpDescription.bolusStep = 0.1d; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityAAPS/SensitivityAAPSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityAAPS/SensitivityAAPSPlugin.java index d7421a3aa2..75b1ea9675 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityAAPS/SensitivityAAPSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityAAPS/SensitivityAAPSPlugin.java @@ -47,7 +47,6 @@ public class SensitivityAAPSPlugin extends PluginBase implements SensitivityInte .pluginName(R.string.sensitivityaaps) .shortName(R.string.sensitivity_shortname) .preferencesId(R.xml.pref_absorption_aaps) - .description(R.string.description_sensitivity_aaps) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityOref0/SensitivityOref0Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityOref0/SensitivityOref0Plugin.java index e4bf00be99..15be72880d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityOref0/SensitivityOref0Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityOref0/SensitivityOref0Plugin.java @@ -46,7 +46,6 @@ public class SensitivityOref0Plugin extends PluginBase implements SensitivityInt .pluginName(R.string.sensitivityoref0) .shortName(R.string.sensitivity_shortname) .preferencesId(R.xml.pref_absorption_oref0) - .description(R.string.description_sensitivity_oref0) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityWeightedAverage/SensitivityWeightedAveragePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityWeightedAverage/SensitivityWeightedAveragePlugin.java index 3d33b5ae14..58f59701d9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityWeightedAverage/SensitivityWeightedAveragePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SensitivityWeightedAverage/SensitivityWeightedAveragePlugin.java @@ -43,7 +43,6 @@ public class SensitivityWeightedAveragePlugin extends PluginBase implements Sens .pluginName(R.string.sensitivityweightedaverage) .shortName(R.string.sensitivity_shortname) .preferencesId(R.xml.pref_absorption_aaps) - .description(R.string.description_sensitivity_weighted_average) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java index 8e1dd06d2f..9de6cc6ad6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java @@ -124,7 +124,6 @@ public class SmsCommunicatorPlugin extends PluginBase { .pluginName(R.string.smscommunicator) .shortName(R.string.smscommunicator_shortname) .preferencesId(R.xml.pref_smscommunicator) - .description(R.string.description_sms_communicator) ); processSettings(null); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceDexcomG5Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceDexcomG5Plugin.java index af040c8c90..d526a12971 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceDexcomG5Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceDexcomG5Plugin.java @@ -29,7 +29,6 @@ public class SourceDexcomG5Plugin extends PluginBase implements BgSourceInterfac .shortName(R.string.dexcomG5_shortname) .showInList(!Config.NSCLIENT) .preferencesId(R.xml.pref_dexcomg5) - .description(R.string.description_source_dexcom_g5) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceGlimpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceGlimpPlugin.java index 38b891ff65..0846885df7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceGlimpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceGlimpPlugin.java @@ -24,7 +24,6 @@ public class SourceGlimpPlugin extends PluginBase implements BgSourceInterface { .mainType(PluginType.BGSOURCE) .fragmentClass(BGSourceFragment.class.getName()) .pluginName(R.string.Glimp) - .description(R.string.description_source_glimp) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceMM640gPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceMM640gPlugin.java index 041b084efd..8df63df1e6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceMM640gPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceMM640gPlugin.java @@ -23,7 +23,6 @@ public class SourceMM640gPlugin extends PluginBase implements BgSourceInterface .mainType(PluginType.BGSOURCE) .fragmentClass(BGSourceFragment.class.getName()) .pluginName(R.string.MM640g) - .description(R.string.description_source_mm640g) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceNSClientPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceNSClientPlugin.java index e3c4181c05..3bf5c66cca 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceNSClientPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceNSClientPlugin.java @@ -27,7 +27,6 @@ public class SourceNSClientPlugin extends PluginBase implements BgSourceInterfac .pluginName(R.string.nsclientbg) .showInList(!Config.NSCLIENT) .alwaysEnabled(Config.NSCLIENT) - .description(R.string.description_source_ns_client) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourcePoctechPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourcePoctechPlugin.java deleted file mode 100644 index 13cb99d392..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourcePoctechPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package info.nightscout.androidaps.plugins.Source; - -import info.nightscout.androidaps.Config; -import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.BgSourceInterface; -import info.nightscout.androidaps.interfaces.PluginBase; -import info.nightscout.androidaps.interfaces.PluginDescription; -import info.nightscout.androidaps.interfaces.PluginType; - -/** - * Created by mike on 05.08.2016. - */ -public class SourcePoctechPlugin extends PluginBase implements BgSourceInterface { - - private static SourcePoctechPlugin plugin = null; - - public static SourcePoctechPlugin getPlugin() { - if (plugin == null) - plugin = new SourcePoctechPlugin(); - return plugin; - } - - private SourcePoctechPlugin() { - super(new PluginDescription() - .mainType(PluginType.BGSOURCE) - .fragmentClass(BGSourceFragment.class.getName()) - .pluginName(R.string.poctech) - .showInList(!Config.NSCLIENT) - .preferencesId(R.xml.pref_poctech) - .description(R.string.description_source_poctech) - ); - } - - @Override - public boolean advancedFilteringSupported() { - return false; - } - -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceXdripPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceXdripPlugin.java index fa61c9ea61..bd3d96162e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceXdripPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceXdripPlugin.java @@ -26,7 +26,6 @@ public class SourceXdripPlugin extends PluginBase implements BgSourceInterface { .mainType(PluginType.BGSOURCE) .fragmentClass(BGSourceFragment.class.getName()) .pluginName(R.string.xdrip) - .description(R.string.description_source_xdrip) ); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java index a754b7dcfa..8ae2e6d7b1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java @@ -80,7 +80,6 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface .shortName(R.string.treatments_shortname) .preferencesId(R.xml.pref_absorption_oref0) .alwaysEnabled(true) - .description(R.string.description_treatments) ); this.service = new TreatmentService(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearPlugin.java index 6cb47e1a3a..7282ac0763 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearPlugin.java @@ -56,7 +56,6 @@ public class WearPlugin extends PluginBase { .pluginName(R.string.wear) .shortName(R.string.wear_shortname) .preferencesId(R.xml.pref_wear) - .description(R.string.description_wear) ); this.ctx = ctx; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java index d5ac60a626..03c6c48a1a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java @@ -70,7 +70,6 @@ public class StatuslinePlugin extends PluginBase { .shortName(R.string.xdripstatus_shortname) .neverVisible(true) .preferencesId(R.xml.pref_xdripstatus) - .description(R.string.description_xdrip_status_line) ); this.ctx = ctx; this.mPrefs = PreferenceManager.getDefaultSharedPreferences(ctx); diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java index 9f2fdf7eee..f76e6044aa 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java @@ -405,7 +405,7 @@ public class CommandQueue { } // returns true if command is queued - public boolean setUserOptions(Callback callback) { + public boolean setUserSettings(Callback callback) { if (isRunning(Command.CommandType.SETUSERSETTINGS)) { if (callback != null) callback.result(executingNowError()).run(); diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java index 0e7ba0e623..dbdb22782a 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java @@ -18,7 +18,6 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; -import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.PreferencesActivity; import info.nightscout.androidaps.R; @@ -86,14 +85,8 @@ public class SWDefinition { return this; } - SWDefinition() { - if (BuildConfig.FLAVOR.equals("full")) - SWDefinitionFull(); - else if (BuildConfig.FLAVOR.equals("nsclient")) - SWDefinitionNSClient(); - } - private void SWDefinitionFull() { + SWDefinition() { // List all the screens here add(new SWScreen(R.string.nav_setupwizard) .add(new SWInfotext() @@ -235,7 +228,6 @@ public class SWDefinition { .add(new SWBreak()) .add(new SWPlugin() .option(PluginType.INSULIN) - .makeVisible(false) .label(R.string.configbuilder_insulin)) .add(new SWBreak()) .add(new SWButton() @@ -449,177 +441,4 @@ public class SWDefinition { ; } - private void SWDefinitionNSClient() { - // List all the screens here - add(new SWScreen(R.string.nav_setupwizard) - .add(new SWInfotext() - .label(R.string.welcometosetupwizard)) - .add(new SWButton() - .text(R.string.nav_import) - .action(() -> ImportExportPrefs.importSharedPreferences(getActivity())) - .visibility(ImportExportPrefs.file::exists)) - .add(new SWInfotext() - .label(R.string.backupismissing) - .visibility(() -> !ImportExportPrefs.file.exists())) - ) - .add(new SWScreen(R.string.language) - .skippable(false) - .add(new SWRadioButton() - .option(R.array.languagesArray, R.array.languagesValues) - .preferenceId(R.string.key_language).label(R.string.language) - .comment(R.string.setupwizard_language_prompt)) - .validator(() -> { - String lang = SP.getString("language", "en"); - LocaleHelper.setLocale(MainApp.instance().getApplicationContext(), lang); - return SP.contains(R.string.key_language); - }) - ) - .add(new SWScreen(R.string.end_user_license_agreement) - .skippable(false) - .add(new SWInfotext() - .label(R.string.end_user_license_agreement_text)) - .add(new SWBreak()) - .add(new SWButton() - .text(R.string.end_user_license_agreement_i_understand) - .visibility(() -> !SP.getBoolean(R.string.key_i_understand, false)) - .action(() -> { - SP.putBoolean(R.string.key_i_understand, true); - MainApp.bus().post(new EventSWUpdate(false)); - })) - .visibility(() -> !SP.getBoolean(R.string.key_i_understand, false)) - .validator(() -> SP.getBoolean(R.string.key_i_understand, false)) - ) - .add(new SWScreen(R.string.permission) - .skippable(false) - .add(new SWInfotext() - .label(String.format(MainApp.gs(R.string.needwhitelisting), MainApp.gs(R.string.app_name)))) - .add(new SWBreak()) - .add(new SWButton() - .text(R.string.askforpermission) - .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)) - .action(() -> AndroidPermission.askForPermission(getActivity(), Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, AndroidPermission.CASE_BATTERY))) - .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)) - .validator(() -> !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS))) - ) - .add(new SWScreen(R.string.permission) - .skippable(false) - .add(new SWInfotext() - .label(MainApp.gs(R.string.needstoragepermission))) - .add(new SWBreak()) - .add(new SWButton() - .text(R.string.askforpermission) - .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) - .action(() -> AndroidPermission.askForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE, AndroidPermission.CASE_STORAGE))) - .visibility(() -> Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE)) - .validator(() -> !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !AndroidPermission.checkForPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE))) - ) - .add(new SWScreen(R.string.nsclientinternal_title) - .skippable(true) - .add(new SWInfotext() - .label(R.string.nsclientinfotext)) - .add(new SWBreak()) - .add(new SWButton() - .text(R.string.enable_nsclient) - .action(() -> { - NSClientPlugin.getPlugin().setPluginEnabled(PluginType.GENERAL, true); - NSClientPlugin.getPlugin().setFragmentVisible(PluginType.GENERAL, true); - ConfigBuilderFragment.processOnEnabledCategoryChanged(NSClientPlugin.getPlugin(), PluginType.GENERAL); - ConfigBuilderPlugin.getPlugin().storeSettings("SetupWizard"); - MainApp.bus().post(new EventConfigBuilderChange()); - MainApp.bus().post(new EventSWUpdate(true)); - }) - .visibility(() -> !NSClientPlugin.getPlugin().isEnabled(PluginType.GENERAL))) - .add(new SWEditUrl() - .preferenceId(R.string.key_nsclientinternal_url) - .label(R.string.nsclientinternal_url_title) - .comment(R.string.nsclientinternal_url_dialogmessage)) - .add(new SWEditString() - .validator(text -> text.length() >= 12) - .preferenceId(R.string.key_nsclientinternal_api_secret) - .label(R.string.nsclientinternal_secret_dialogtitle) - .comment(R.string.nsclientinternal_secret_dialogmessage)) - .add(new SWBreak()) - .add(new SWEventListener(this) - .label(R.string.status) - .initialStatus(NSClientPlugin.getPlugin().status) - .listener(new Object() { - @Subscribe - public void onEventNSClientStatus(EventNSClientStatus event) { - MainApp.bus().post(new EventSWLabel(event.status)); - } - }) - ) - .add(new SWBreak()) - .validator(() -> NSClientPlugin.getPlugin().nsClientService != null && NSClientPlugin.getPlugin().nsClientService.isConnected && NSClientPlugin.getPlugin().nsClientService.hasWriteAuth) - .visibility(() -> !(NSClientPlugin.getPlugin().nsClientService != null && NSClientPlugin.getPlugin().nsClientService.isConnected && NSClientPlugin.getPlugin().nsClientService.hasWriteAuth)) - ) - .add(new SWScreen(R.string.patientage) - .skippable(false) - .add(new SWInfotext() - .label(R.string.patientage_summary)) - .add(new SWBreak()) - .add(new SWRadioButton() - .option(R.array.ageArray, R.array.ageValues) - .preferenceId(R.string.key_age) - .label(R.string.patientage) - .comment(R.string.patientage_summary)) - .validator(() -> SP.contains(R.string.key_age)) - ) - .add(new SWScreen(R.string.configbuilder_insulin) - .skippable(false) - .add(new SWInfotext() - .label(MainApp.gs(R.string.rapid_acting_oref) + ": " + MainApp.gs(R.string.fastactinginsulincomment))) - .add(new SWInfotext() - .label(MainApp.gs(R.string.ultrarapid_oref) + ": " + MainApp.gs(R.string.ultrafastactinginsulincomment))) - .add(new SWInfotext() - .label(MainApp.gs(R.string.free_peak_oref) + ": " + MainApp.gs(R.string.free_peak_oref_description))) - .add(new SWBreak()) - .add(new SWInfotext() - .label(R.string.diawarning)) - .add(new SWBreak()) - .add(new SWPlugin() - .option(PluginType.INSULIN) - .makeVisible(false) - .label(R.string.configbuilder_insulin)) - .add(new SWBreak()) - .add(new SWButton() - .text(R.string.insulinsourcesetup) - .action(() -> { - final PluginBase plugin = (PluginBase) MainApp.getConfigBuilder().getActiveInsulin(); - PasswordProtection.QueryPassword(activity, R.string.settings_password, "settings_password", () -> { - Intent i = new Intent(activity, PreferencesActivity.class); - i.putExtra("id", plugin.getPreferencesId()); - activity.startActivity(i); - }, null); - }) - .visibility(() -> MainApp.getConfigBuilder().getActiveInsulin()!= null && ((PluginBase) MainApp.getConfigBuilder().getActiveInsulin()).getPreferencesId() > 0)) - .validator(() -> MainApp.getConfigBuilder().getActiveInsulin() != null) - ) - .add(new SWScreen(R.string.configbuilder_sensitivity) - .skippable(false) - .add(new SWInfotext() - .label(R.string.setupwizard_sensitivity_description)) - .add(new SWHtmlLink() - .label(R.string.setupwizard_sensitivity_url)) - .add(new SWBreak()) - .add(new SWPlugin() - .option(PluginType.SENSITIVITY) - .label(R.string.configbuilder_sensitivity)) - .add(new SWBreak()) - .add(new SWButton() - .text(R.string.sensitivitysetup) - .action(() -> { - final PluginBase plugin = (PluginBase) MainApp.getConfigBuilder().getActiveSensitivity(); - PasswordProtection.QueryPassword(activity, R.string.settings_password, "settings_password", () -> { - Intent i = new Intent(activity, PreferencesActivity.class); - i.putExtra("id", plugin.getPreferencesId()); - activity.startActivity(i); - }, null); - }) - .visibility(() -> MainApp.getConfigBuilder().getActiveSensitivity() != null && ((PluginBase) MainApp.getConfigBuilder().getActiveSensitivity()).getPreferencesId() > 0)) - .validator(() -> MainApp.getConfigBuilder().getActiveSensitivity() != null) - ) - ; - } - } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWPlugin.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWPlugin.java index 06735ee72e..b9519bc9b5 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/elements/SWPlugin.java @@ -25,8 +25,6 @@ public class SWPlugin extends SWItem { private PluginType pType; private RadioGroup radioGroup; - private boolean makeVisible = true; - public SWPlugin() { super(Type.PLUGIN); } @@ -36,11 +34,6 @@ public class SWPlugin extends SWItem { return this; } - public SWPlugin makeVisible(boolean makeVisible) { - this.makeVisible = makeVisible; - return this; - } - @Override public void generateDialog(View view, LinearLayout layout) { Context context = view.getContext(); @@ -65,10 +58,10 @@ public class SWPlugin extends SWItem { radioGroup.setOnCheckedChangeListener((group, checkedId) -> { RadioButton rb = group.findViewById(checkedId); - PluginBase plugin = (PluginBase) rb.getTag(); - plugin.setPluginEnabled(pType, rb.isChecked()); - plugin.setFragmentVisible(pType, rb.isChecked() && makeVisible); - ConfigBuilderFragment.processOnEnabledCategoryChanged(plugin, pType); + PluginBase plugin1 = (PluginBase) rb.getTag(); + plugin1.setPluginEnabled(pType, rb.isChecked()); + plugin1.setFragmentVisible(pType, rb.isChecked()); + ConfigBuilderFragment.processOnEnabledCategoryChanged(plugin1, pType); ConfigBuilderPlugin.getPlugin().storeSettings("SetupWizard"); MainApp.bus().post(new EventConfigBuilderChange()); MainApp.bus().post(new EventSWUpdate()); diff --git a/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java b/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java index 79037ebcd8..c17646e901 100644 --- a/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java +++ b/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java @@ -3,11 +3,9 @@ package info.nightscout.androidaps.tabs; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; -import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter; import android.view.ViewGroup; @@ -21,7 +19,7 @@ import info.nightscout.androidaps.interfaces.PluginBase; /** * Created by mike on 30.05.2016. */ -public class TabPageAdapter extends FragmentPagerAdapter { +public class TabPageAdapter extends FragmentStatePagerAdapter { ArrayList visibleFragmentList = new ArrayList<>(); @@ -78,8 +76,5 @@ public class TabPageAdapter extends FragmentPagerAdapter { } } - @Override - public long getItemId(int position) { - return System.identityHashCode(visibleFragmentList.get(position)); - } + } diff --git a/app/src/main/res/drawable-hdpi/ic_visibility.png b/app/src/main/res/drawable-hdpi/ic_visibility.png deleted file mode 100644 index a014628e30b96b396a207ea86b52c54e81c2b28e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 953 zcmV;q14jIbP)eP6?gL`upo2_f0a0b^*4$r93#LP<@A14|MPXc9TGWEsnFVmUAeI1nLA zvgbgN2^q$ivE|bBx&L~<_kExD{~a)WQ{R2^9{lg;ey-=buX}mLEHlkAJj?;=%g7u< z{|iI5w*C}#T3x|sT|K;0_EKgWBE!xD>dhQq+o< z%VU$`tp{!f?w7Q>6{s1&_94Jcz-ho1V*>mRyajv!tO5dRHz4PZEEb24{RzARER~eA zBQ_S0?daqoU>{(Up;Ni|3t$QGI!iBAIuHXipLuu#(H-S=q>*?t6AG|*QD~wj=Ohflr!Z zKUGCtDCx)YI|X>Ip{b;Ag`|ZefNY;tscL27ZQu+^-`L&?cpRADa9#gZ$FhV#$BWs;WL-n`mIilAkY!l{zJno3!* zld9UjaU!C-ThcYreZBeii!DsGpwwEV9I?wZi2(xa}GbZ-Y}0q_8@-3$R;0W9kQ zbcdwt3eZ(~&;&pkIZGrh>j2HJl+`OzT@h-_-UQ}JT4j6N($MJ*=a);=Yi#cXJOxB| zExTA!Bs0>7(lb(R!`(T)85Q#-y;u+EE;+I5C0PPJuZTqG$&wQ08Z1s(>DX*}+G;Cx`Eq*UdUwT9~n zrKjvZ^v)?QRt{+%a z$E9f|3tD>3oxpwBp9UxVV8FgLbjr8%aBIz@4AqQ-zOw(SQtsa`UO~%-&Sf`O!d*;$MApteGX6`rE?5z bbPW9sBP~=k&$Y&)00000NkvXXu0mjfyXMBt diff --git a/app/src/main/res/drawable-mdpi/ic_visibility.png b/app/src/main/res/drawable-mdpi/ic_visibility.png deleted file mode 100644 index d5a9dc9ca4226dbae86a19e095a11d8f721b15a0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 413 zcmV;O0b>4%P)qa1UHcdZ|ZqO^R#}04u;W z&{ZSIGjIf~OS;Q?^9vwmyap@+ttqF^_}!Aa{{VJ?)pSKw0Ji&pQ=pItVBi4Q1a9K} z5KsbUp=waBfC)(t75^Uq+ugt!FqjHnlC+gozU^WJP9}N_j7us9pCrIxT?*VhE1db%l`~cXV1dcPZ9FufmJ5;cgvTsW&+8zbYGkm8coqShd zJ8(Cg(a;V_@3xo!R@CGV7wz(k3c;F zIXzHMp_~rPEj}s{FtbI#dSDf>1Xu_(0MmknKY`D{Ti_+|1b86nO^zAM<IIz?&3(-*!c)hPEE*edCDmRu$PGiwHJ0JE}`0pEZt zz#ZV3q%SUGX0w46z$Rb^Ff&2dSD;nWy=uHw0hpN=Xcv&>K`%(>J5n;b(xU;)iO>MD z9Ow~jljMb7mMSVRvn|1!p8M74H?UXI#RRVou$b9y;5;xfL(XeqyClzoVN@1?nXLmn zbdxibyXW`RYJ5p&0C6Fq1^)t?Bt0Bz&oBUHHV=3X%uVoUr=(pmpP4!6eIeI}LfyfZ|{G%$ymslOdnm7_>b_Up=_->1&+a=zC2$-37 znpc4L{1j@IbUy-c5IB`02pp1hI+AS)HJ2jp(ON92f5yZBd^PZVOr?e)>EoXDUY|lf zBL>neq>(RssnjmX+x8#;FTzrmqNGpKpblkbzRyfe5e9lCl{VFW5i|4R&YCwR^*xf7 zjW&Q@V9Iy`D0~VPyNE*`7NL!9mUL@a8;x38aR*t5La|qg0AelRL#lYoT$DvRO7xIZ)zh~oZIMj(p&Qy+mS?pYf`cY5Ie5stg>{+r`&;@UjsY*~k;F*hLZ19bp-J(yR%9)Y|b%qw4yKwb~#l`nh* Z{sK;sc0e^r-If3V002ovPDHLkV1fe;bmjm6 diff --git a/app/src/main/res/drawable-xxhdpi/ic_visibility.png b/app/src/main/res/drawable-xxhdpi/ic_visibility.png deleted file mode 100644 index dbc192368f897f52b0c1c502ba56492247021f47..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2094 zcmV+}2+{Y6P)C)(p%GMSi>U#OAZn|v)*9!zz#lf&iGbFDYKuYz z5@ZO-P*96$Vxnl8Qd^BiY89-F^UzxAu*~QNSU9f3y4t*bDpv_%rZ(;C^7Iq zfRlhDfk!4#9sxWII0$%1n*RTQ{{sI849LHL-M}A#9|Cs(8zud--g4_deLw(;29a+W0c=HD11KU61>Ogo2Rs>gcq=okuEapy2V4)Vko4E;ua17QF+j<`yaf0{I#O-S ztErCdz`KAAlI**(r4c|8F&lUfa87c%*%LVcFFpX=2z*M?rd<7503}~zP*$Yl|h^~ggdJ(OOUPnS7yNiHt;m z+p#|bcu{irP7Rzd<@z<}RG&@OR4X;81yDpdvAZyZZUa?UyrcI3R{*y;JeP&$WUU6v zQStRDkLo3qb;dVH-vpLR+FA9*$^a#Bz6QK1C3RKD=soA7v)a1|>?i|fPx9nN-;`5%H#UWFD6RlzrVz zb`z5RP&QU6KoQ|O>2tuF`)Z{!z5T!c1^A$kRa6ZvGw@fHEn@2d0r!2zd0%Ou`k`|0t8$TyG&Us$u(c0j8vS?ylW^= zz;#t!u_=F5(vndxrikd$WUHDY$#SV41(-KzJ*ndV5^!z>%NZQomUOHAl_W>TNl8|8HE?$Bgn@g3GbH`I zU&j=HBEt30+f(E+)0ZntBwbcuJtw9_Ew@B*t>#5+DA4WPXvhL;EWnZM)2=Tbn3Owc%?d+2<7kbXKZYa%!EP zP9KF?lDykfBqFu}$2VNWFC;y)K(`BAb3aX30Ov-FC9NF=(2s%VH(bCTNrgu!A{@4x z99>UsuOv4Ch9n|fsplTwp1#eJCR3ZiBj#M-ISm2YEos(>1(?Ljr7U_X_em-QIU?L9 zDjd7Unzl)Dq@9r?_A}tP8j~%0)D+3FGj+rcPnE8_5lv*aq#=hH5f1T=l1*f-BqxSb zBq9vFH=v0)Z=2hn{TGG#Wr^BwF_ zG4RomVcwdjAyNEds>16=o0(4(6F{~qb3bcxx57PiV2-3AlaB~T2zMKtvDXokTMHy@ zEU=!Z0(UlSJG}$=${?{nu2^-s@#;*j#l@;S39iD2x||U)C*@oAd1aR5_uZ2}Pty7V zaJ&Y$x9#5w!+*&xSpS`pPA__{qdWHZ^=+9$nZE%W2atExy)W~~kFIkT(zC8-R!MsI zsCN_BZC=RZm;&)p@tmCMe;>F8*d)mp6$&LH+yr=UCgW+s?8COce#hKDP#NXwlEb|3 zqD;ol=4+yVog_zz)+Euvz0xR$a`gt90Wi%`pK|T3J5X8`$3CkRrm>x;bkz zkOsyjiZ6ZUQ@#KX7WCk z9JsrkIgT_J5WnX{)W^w}IPHk1w1#pOw+2w3Z|bfAm+eOCui1*+!EjPH5AgT4HpI@> z7UFw8zQ$r&#ktjFKdWqxRex`5!ehrvw>VzrrXTR)1eQa&349+#f1IKB=3@XHfqZQI zF@54t?R$;B&*;wW_sYtIsvwMeZdw2u@Ku9MW=k0-Xgl!>{u}odtCk)C_^nf|}v? Yf97D4XDiAHeOH_*}95mhC$MRZY1 zB#k9Vv`;G?)ka&|4h@}_3?bIBG(7JQc<;O)KKGvU`P}pQ;huZW=Uxx=_kzl6$^!rZ zMR|J!9rWn`Kvw#o&fdc)`asG*?`Y^tNn)uMQ=@$86{KLR=zkWv? zt3qO%$q&%1%S4|Ja+$Ro&*h#Pi+}BRZewBL)F>Q_GgdQEpp{~5X{FLN@y(1`&i43; z-NpVde@`V~#+LAy{QNnJO;>$b*N0XH#-s7kp};ds<@QhlxAZRP4e$V2z+J4Bwgyam z?;hKwf)4mY4}Kp=bOGO`Nt$$FHUHO0G))p7qZOSMZ5y4y{}+3$;7P#~LIP;a8-G&j zhYk+1r7FthhqA{Ay9K)j;!awt5iLp+N+fDXV5O&J7iCzoG(?%i7Btl;)ikxT>5Dm7 z?+l1Y)FFH&Fu}QTYPjko=u0KSLcv9Yu<%E3h7Ppy0;a^W@8kSN6RUmQ@qL3Q-H z6W$`tNdc?}ua~QX)G02~U!oNG8w&hjwmNCgoo?{0dEHUwMnrAnh6ntXk^UML57x`Jos-a&hRuB35^XRI$`UHHxoO-4mc{2Q3WToo zY~L_|NSp&rAegiwAa6)~Hcewt$q8_Rk9-EJ%w*#r7E+PWMJ1Lo<+g9xi)%fN2xr;= zrQH@#=~NJHxV3$AW_z+V5aQUEaYtgT_}+YLKEr)a`0<1J!adSuUYGbeWt{3^V>Wo)TUnvR%A`YAyTjKrtSr+f)bc{bKBe_k{XhT)yg&~s{ z9%7zmu&In?z}|+FP3%XAY3+GAU}cp}MsiYGu{vvRuxtIP)#<~D zj=c_Dr@NIVLwVev;tgT$fXGFsZwyuK?ZCiZQ|XM=yrM%uS1vDq5mq>^#k!Jin$VDmgLj?~x=^r!+}$Xs|5R9%JgC4CXEO z4p*`obwL(_3yz{)V^Z7vPKzpmC}P(+a|J0m5t&mC;vYmiwXGrTgz}T%<(q%H&-(ey zN%p<7A6XLoOk%yE^85gv$`_8&Tw*$}pX3nGqH>8BwTyV`^0nGkyYq$|A|RRAtRY;=usrB6-J~uM3QW9 z@Y7Oy@Q9t2@ep}ZdZ1!!vZLwK%FVpxS3Pdp(>Ic^)K5ifjyvuJKs|cA+IN*TaWCxP z+SpCNV49zg_3cLC~RQj$g=8^EWem5i;_UnfV5 zHY7~u4DbGZmcEA6uz_nErODgaZu@mK8fcV1@l>_ZgDIubd@*U8luAlwR$(feHXFn6h?;z$eD49`!9beJxbC?n^ zefbYqYa>Wy#g#vfz$n?3cMFhABs}S8R3LHx87c2Ut@ns@a9x`C`f-Z}$Cyt9~oheGeoeH=Vu(1C)~Fp5DEtQ0II$ zZs3pbKneC=q2scS>oeyQg%C5euJATBkzn8Rn#H1G)Z`@WUavjy^Mw3#~!nhT|VO+-JHY6gkpwcR< z`SZe>@wZ+)W2jZ1>}u7%U2gSd2Nghn@(D zs%m@qbA%;Rhn7iOW zI4bYLE8dJAhbWhTE$>5318z}fd}iu3d*?Bamq%!q>`uBv=}(|0M0GavHNT*`_BV@+|;f4gim^`b81 zMZNi^m6i1K_yu!adaa{C5EFWQ7gn<1YnFO4_p4u6Zf|$R8{6l{&m^;pkBV08Z2^<^ kLh1i27yoN?R)MxG^l$9oPj$^>4}Jgu<>~Ly<`!M}Z@sqTT>t<8 diff --git a/app/src/main/res/drawable/visibility_black_16x16.png b/app/src/main/res/drawable/visibility_black_16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..d24867dcdf25e7cf90ddd1c90d999359b2410d3f GIT binary patch literal 233 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6Hh8)?hG>ZHJ?QP_#K^#UA$dlw z!^Ox823=u7mli2?D4ek4o@lVxlkb*Op!5sVugwxwpJxi2Kd{WX*vTHBmS%U?dRyZ8 zxvdf}D@{bW&9km$#kuTRrESXN@+D+#OsB+3>);<3ubGGyCcZqdzC(^nkoA{R+PCr} z`&qTT99=b&UIrZraE^X>d*!swj$-ZI^IUjLrbgX!DG6PBwdBmvi2Iv6XY3B!`tZbB h{@~#ER(!eV diff --git a/app/src/main/res/layout/combopump_fragment.xml b/app/src/main/res/layout/combopump_fragment.xml index 45e6993b99..5bb90090be 100644 --- a/app/src/main/res/layout/combopump_fragment.xml +++ b/app/src/main/res/layout/combopump_fragment.xml @@ -2,7 +2,6 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:paddingTop="5dp" tools:context=".plugins.PumpCombo.ComboFragment"> - -