diff --git a/app/build.gradle b/app/build.gradle index 2187665829..d11de37848 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -180,8 +180,4 @@ dependencies { compile 'com.google.code.gson:gson:2.7' compile 'com.google.guava:guava:20.0' - compile ('com.jakewharton:butterknife:8.5.1') { - exclude module: 'support-compat' - } - annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index 358c4e4d38..25ae1ed054 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -50,7 +50,7 @@ import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangeFragmen import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment; import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpFragment; import info.nightscout.androidaps.plugins.Wear.WearFragment; -import info.nightscout.androidaps.plugins.persistentnotification.PersistentNotificationPlugin; +import info.nightscout.androidaps.plugins.Persistentnotification.PersistentNotificationPlugin; import info.nightscout.androidaps.receivers.KeepAliveReceiver; import io.fabric.sdk.android.Fabric; diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/FragmentBase.java b/app/src/main/java/info/nightscout/androidaps/interfaces/FragmentBase.java deleted file mode 100644 index 79bfc75154..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/FragmentBase.java +++ /dev/null @@ -1,7 +0,0 @@ -package info.nightscout.androidaps.interfaces; - -/** - * Created by mike on 05.08.2016. - */ -public interface FragmentBase { -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java index c3ea14dc79..582feb89a6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java @@ -17,17 +17,16 @@ import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventRefreshGui; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.Actions.dialogs.FillDialog; -import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog; -import info.nightscout.androidaps.plugins.Careportal.OptionsToShow; import info.nightscout.androidaps.plugins.Actions.dialogs.NewExtendedBolusDialog; import info.nightscout.androidaps.plugins.Actions.dialogs.NewTempBasalDialog; +import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog; +import info.nightscout.androidaps.plugins.Careportal.OptionsToShow; /** * A simple {@link Fragment} subclass. */ -public class ActionsFragment extends Fragment implements FragmentBase, View.OnClickListener { +public class ActionsFragment extends Fragment implements View.OnClickListener { static ActionsPlugin actionsPlugin = new ActionsPlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalFragment.java index 69db12c29b..7c603ecaed 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/CareportalFragment.java @@ -9,10 +9,9 @@ import android.view.View; import android.view.ViewGroup; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog; -public class CareportalFragment extends Fragment implements FragmentBase, View.OnClickListener { +public class CareportalFragment extends Fragment implements View.OnClickListener { static CareportalPlugin careportalPlugin; 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 1f9e8b6389..4569c4b2f9 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 @@ -21,9 +21,6 @@ import com.crashlytics.android.answers.CustomEvent; import java.util.ArrayList; -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.Unbinder; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventConfigBuilderChange; @@ -31,7 +28,6 @@ import info.nightscout.androidaps.events.EventRefreshGui; import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.BgSourceInterface; import info.nightscout.androidaps.interfaces.ConstraintsInterface; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.interfaces.InsulinInterface; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.ProfileInterface; @@ -42,7 +38,7 @@ import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin; import info.nightscout.utils.PasswordProtection; -public class ConfigBuilderFragment extends Fragment implements FragmentBase { +public class ConfigBuilderFragment extends Fragment { static ConfigBuilderPlugin configBuilderPlugin = new ConfigBuilderPlugin(); @@ -50,42 +46,26 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase { return configBuilderPlugin; } - @BindView(R.id.configbuilder_insulinlistview) ListView insulinListView; - @BindView(R.id.configbuilder_bgsourcelistview) ListView bgsourceListView; - @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_tempslistview) ListView tempsListView; - @BindView(R.id.configbuilder_tempslabel) TextView tempsLabel; - @BindView(R.id.configbuilder_profilelistview) ListView profileListView; - @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.configbuilder_nsclientversion) TextView nsclientVerView; - @BindView(R.id.configbuilder_nightscoutversion) TextView nightscoutVerView; - private Unbinder unbinder; + LinearLayout mainLayout; + Button unlock; PluginCustomAdapter insulinDataAdapter = null; PluginCustomAdapter bgsourceDataAdapter = null; @@ -98,11 +78,6 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase { PluginCustomAdapter constraintsDataAdapter = null; PluginCustomAdapter generalDataAdapter = null; - @BindView(R.id.configbuilder_mainlayout) - LinearLayout mainLayout; - @BindView(R.id.configbuilder_unlock) - Button unlock; - // TODO: sorting @Override @@ -110,7 +85,26 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase { Bundle savedInstanceState) { View view = inflater.inflate(R.layout.configbuilder_fragment, container, false); - unbinder = ButterKnife.bind(this, view); + insulinListView = (ListView) view.findViewById(R.id.configbuilder_insulinlistview); + bgsourceListView = (ListView) view.findViewById(R.id.configbuilder_bgsourcelistview); + pumpListView = (ListView) view.findViewById(R.id.configbuilder_pumplistview); + pumpLabel = (TextView) view.findViewById(R.id.configbuilder_pumplabel); + loopListView = (ListView) view.findViewById(R.id.configbuilder_looplistview); + loopLabel = (TextView) view.findViewById(R.id.configbuilder_looplabel); + treatmentsListView = (ListView) view.findViewById(R.id.configbuilder_treatmentslistview); + tempsListView = (ListView) view.findViewById(R.id.configbuilder_tempslistview); + tempsLabel = (TextView) view.findViewById(R.id.configbuilder_tempslabel); + profileListView = (ListView) view.findViewById(R.id.configbuilder_profilelistview); + apsListView = (ListView) view.findViewById(R.id.configbuilder_apslistview); + apsLabel = (TextView) view.findViewById(R.id.configbuilder_apslabel); + constraintsListView = (ListView) view.findViewById(R.id.configbuilder_constraintslistview); + constraintsLabel = (TextView) view.findViewById(R.id.configbuilder_constraintslabel); + generalListView = (ListView) view.findViewById(R.id.configbuilder_generallistview); + nsclientVerView = (TextView) view.findViewById(R.id.configbuilder_nsclientversion); + nightscoutVerView = (TextView) view.findViewById(R.id.configbuilder_nightscoutversion); + + mainLayout = (LinearLayout) view.findViewById(R.id.configbuilder_mainlayout); + unlock = (Button) view.findViewById(R.id.configbuilder_unlock); nsclientVerView.setText(ConfigBuilderPlugin.nsClientVersionName); nightscoutVerView.setText(ConfigBuilderPlugin.nightscoutVersionName); @@ -139,12 +133,6 @@ public class ConfigBuilderFragment extends Fragment implements FragmentBase { return view; } - @Override - public void onDestroyView() { - super.onDestroyView(); - unbinder.unbind(); - } - void setViews() { insulinDataAdapter = new PluginCustomAdapter(getContext(), R.layout.configbuilder_simpleitem, MainApp.getSpecificPluginsListByInterface(InsulinInterface.class), PluginBase.INSULIN); insulinListView.setAdapter(insulinDataAdapter); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java index 69ae3bd1a0..3334267057 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsObjectives/ObjectivesFragment.java @@ -23,9 +23,8 @@ import java.util.List; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.FragmentBase; -public class ObjectivesFragment extends Fragment implements View.OnClickListener, FragmentBase { +public class ObjectivesFragment extends Fragment { private static Logger log = LoggerFactory.getLogger(ObjectivesFragment.class); private static ObjectivesPlugin objectivesPlugin; @@ -43,15 +42,6 @@ public class ObjectivesFragment extends Fragment implements View.OnClickListener LinearLayout fake_layout; TextView reset; - @Override - public void onClick(View v) { - int id = v.getId(); - switch (id) { - default: - break; - } - } - public class RecyclerViewAdapter extends RecyclerView.Adapter { List objectives; @@ -236,16 +226,4 @@ public class ObjectivesFragment extends Fragment implements View.OnClickListener }); } - @Override - public void onPause() { - super.onPause(); - MainApp.bus().unregister(this); - } - - @Override - public void onResume() { - super.onResume(); - MainApp.bus().register(this); - } - } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyFragment.java index 8dcc220b3a..07583e7622 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConstraintsSafety/SafetyFragment.java @@ -6,9 +6,7 @@ import android.support.v4.app.Fragment; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import info.nightscout.androidaps.interfaces.FragmentBase; - -public class SafetyFragment extends Fragment implements FragmentBase{ +public class SafetyFragment extends Fragment { private static Logger log = LoggerFactory.getLogger(SafetyFragment.class); private static SafetyPlugin safetyPlugin = new SafetyPlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastacting/InsulinFastactingFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastacting/InsulinFastactingFragment.java index d4444e2fe8..a99e016621 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastacting/InsulinFastactingFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastacting/InsulinFastactingFragment.java @@ -5,42 +5,35 @@ import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; import android.widget.TextView; -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.Unbinder; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.FragmentBase; /** * Created by mike on 17.04.2017. */ -public class InsulinFastactingFragment extends Fragment implements FragmentBase { +public class InsulinFastactingFragment extends Fragment { static InsulinFastactingPlugin insulinFastactingPlugin = new InsulinFastactingPlugin(); static public InsulinFastactingPlugin getPlugin() { return insulinFastactingPlugin; } - private Unbinder unbinder; - @BindView(R.id.insulin_name) TextView insulinName; - @BindView(R.id.insulin_comment) TextView insulinComment; - @BindView(R.id.insulin_dia) TextView insulinDia; - @BindView(R.id.insuling_graph) ActivityGraph insulinGraph; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.insulin_fragment, container, false); - unbinder = ButterKnife.bind(this, view); + insulinName = (TextView) view.findViewById(R.id.insulin_name); + insulinComment = (TextView) view.findViewById(R.id.insulin_comment); + insulinDia = (TextView) view.findViewById(R.id.insulin_dia); + insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph); insulinName.setText(insulinFastactingPlugin.getFriendlyName()); insulinComment.setText(insulinFastactingPlugin.getComment()); @@ -50,11 +43,4 @@ public class InsulinFastactingFragment extends Fragment implements FragmentBase return view; } - @Override - public void onDestroyView() { - super.onDestroyView(); - unbinder.unbind(); - } - - } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastactingProlonged/InsulinFastactingProlongedFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastactingProlonged/InsulinFastactingProlongedFragment.java index d3be3128dd..acc915b001 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastactingProlonged/InsulinFastactingProlongedFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/InsulinFastactingProlonged/InsulinFastactingProlongedFragment.java @@ -5,43 +5,36 @@ import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; import android.widget.TextView; -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.Unbinder; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.InsulinFastacting.ActivityGraph; /** * Created by mike on 17.04.2017. */ -public class InsulinFastactingProlongedFragment extends Fragment implements FragmentBase { +public class InsulinFastactingProlongedFragment extends Fragment { static InsulinFastactingProlongedPlugin insulinFastactingProlongedPlugin = new InsulinFastactingProlongedPlugin(); static public InsulinFastactingProlongedPlugin getPlugin() { return insulinFastactingProlongedPlugin; } - private Unbinder unbinder; - @BindView(R.id.insulin_name) TextView insulinName; - @BindView(R.id.insulin_comment) TextView insulinComment; - @BindView(R.id.insulin_dia) TextView insulinDia; - @BindView(R.id.insuling_graph) ActivityGraph insulinGraph; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.insulin_fragment, container, false); - unbinder = ButterKnife.bind(this, view); + insulinName = (TextView) view.findViewById(R.id.insulin_name); + insulinComment = (TextView) view.findViewById(R.id.insulin_comment); + insulinDia = (TextView) view.findViewById(R.id.insulin_dia); + insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph); insulinName.setText(insulinFastactingProlongedPlugin.getFriendlyName()); insulinComment.setText(insulinFastactingProlongedPlugin.getComment()); @@ -51,11 +44,4 @@ public class InsulinFastactingProlongedFragment extends Fragment implements Frag return view; } - @Override - public void onDestroyView() { - super.onDestroyView(); - unbinder.unbind(); - } - - } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopFragment.java index 43a8fa3c83..de295d8a6e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopFragment.java @@ -19,11 +19,10 @@ import org.slf4j.LoggerFactory; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.Loop.events.EventLoopSetLastRunGui; import info.nightscout.androidaps.plugins.Loop.events.EventLoopUpdateGui; -public class LoopFragment extends Fragment implements View.OnClickListener, FragmentBase { +public class LoopFragment extends Fragment implements View.OnClickListener { private static Logger log = LoggerFactory.getLogger(LoopFragment.class); private static LoopPlugin loopPlugin; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalFragment.java index 3514285473..c3e8c777c6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientInternalFragment.java @@ -28,13 +28,12 @@ import org.slf4j.LoggerFactory; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventPreferenceChange; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI; import info.nightscout.utils.SP; -public class NSClientInternalFragment extends Fragment implements FragmentBase, View.OnClickListener, CompoundButton.OnCheckedChangeListener { +public class NSClientInternalFragment extends Fragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener { private static Logger log = LoggerFactory.getLogger(NSClientInternalFragment.class); static NSClientInternalPlugin nsClientInternalPlugin; @@ -189,5 +188,4 @@ public class NSClientInternalFragment extends Fragment implements FragmentBase, }); } - } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAFragment.java index 76753e86a7..c480ebfe3c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAFragment.java @@ -20,12 +20,11 @@ import org.slf4j.LoggerFactory; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui; import info.nightscout.utils.JSONFormatter; -public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener, FragmentBase { +public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener { private static Logger log = LoggerFactory.getLogger(OpenAPSAMAFragment.class); private static OpenAPSAMAPlugin openAPSAMAPlugin; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAFragment.java index bfe4bb5dab..16249dffc3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAFragment.java @@ -18,18 +18,17 @@ import org.slf4j.LoggerFactory; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui; import info.nightscout.utils.JSONFormatter; -public class OpenAPSMAFragment extends Fragment implements View.OnClickListener, FragmentBase { +public class OpenAPSMAFragment extends Fragment implements View.OnClickListener { private static Logger log = LoggerFactory.getLogger(OpenAPSMAFragment.class); private static OpenAPSMAPlugin openAPSMAPlugin; public static OpenAPSMAPlugin getPlugin() { - if(openAPSMAPlugin==null){ + if (openAPSMAPlugin == null) { openAPSMAPlugin = new OpenAPSMAPlugin(); } return openAPSMAPlugin; 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 4885ced028..2235bbe1dd 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 @@ -40,13 +40,6 @@ import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Date; -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.OnCheckedChanged; -import butterknife.OnClick; -import butterknife.OnItemSelected; -import butterknife.OnTextChanged; -import butterknife.Unbinder; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; @@ -73,68 +66,37 @@ import info.nightscout.utils.SP; import info.nightscout.utils.SafeParse; import info.nightscout.utils.ToastUtils; -import static butterknife.OnItemSelected.Callback.NOTHING_SELECTED; - -public class WizardDialog extends DialogFragment { +public class WizardDialog extends DialogFragment implements OnClickListener, CompoundButton.OnCheckedChangeListener, Spinner.OnItemSelectedListener { private static Logger log = LoggerFactory.getLogger(WizardDialog.class); - @BindView(R.id.treatments_wizard_deliverButton) Button wizardDialogDeliverButton; - @BindView(R.id.treatments_wizard_correctioninput) TextView correctionInput; - @BindView(R.id.treatments_wizard_carbsinput) TextView carbsInput; - @BindView(R.id.treatments_wizard_bginput) TextView bgInput; - @BindView(R.id.treatments_wizard_bg) TextView bg; - @BindView(R.id.treatments_wizard_bginsulin) TextView bgInsulin; - @BindView(R.id.treatments_wizard_bgunits) TextView bgUnits; - @BindView(R.id.treatments_wizard_bgcheckbox) CheckBox bgCheckbox; - @BindView(R.id.treatments_wizard_carbs) TextView carbs; - @BindView(R.id.treatments_wizard_carbsinsulin) TextView carbsInsulin; - @BindView(R.id.treatments_wizard_bolusiobinsulin) TextView bolusIobInsulin; - @BindView(R.id.treatments_wizard_basaliobinsulin) TextView basalIobInsulin; - @BindView(R.id.treatments_wizard_bolusiobcheckbox) CheckBox bolusIobCheckbox; - @BindView(R.id.treatments_wizard_basaliobcheckbox) CheckBox basalIobCheckbox; - @BindView(R.id.treatments_wizard_correctioninsulin) TextView correctionInsulin; - @BindView(R.id.treatments_wizard_total) TextView total; - @BindView(R.id.treatments_wizard_totalinsulin) TextView totalInsulin; - @BindView(R.id.treatments_wizard_carbtimeinput) EditText carbTimeEdit; - @BindView(R.id.treatments_wizard_profile) Spinner profileSpinner; - @BindView(R.id.treatments_wizard_sbcheckbox) CheckBox superbolusCheckbox; - @BindView(R.id.treatments_wizard_sb) TextView superbolus; - @BindView(R.id.treatments_wizard_sbinsulin) TextView superbolusInsulin; - @BindView(R.id.treatments_wizard_bgtrendcheckbox) CheckBox bgtrendCheckbox; - @BindView(R.id.treatments_wizard_bgtrend) TextView bgTrend; - @BindView(R.id.treatments_wizard_bgtrendinsulin) TextView bgTrendInsulin; - @BindView(R.id.treatments_wizard_cob_layout) LinearLayout cobLayout; - @BindView(R.id.treatments_wizard_cobcheckbox) CheckBox cobCheckbox; - @BindView(R.id.treatments_wizard_cob) TextView cob; - @BindView(R.id.treatments_wizard_cobinsulin) TextView cobInsulin; PlusMinusEditText editBg; @@ -142,8 +104,6 @@ public class WizardDialog extends DialogFragment { PlusMinusEditText editCorr; PlusMinusEditText editCarbTime; - private Unbinder unbinder; - Integer calculatedCarbs = 0; Double calculatedTotalInsulin = 0d; JSONObject boluscalcJSON; @@ -167,13 +127,7 @@ public class WizardDialog extends DialogFragment { this.context = context; } - @Override - public void onDestroyView() { - super.onDestroyView(); - unbinder.unbind(); - } - - @Override + @Override public void onResume() { super.onResume(); if (getDialog() != null) @@ -241,8 +195,48 @@ public class WizardDialog extends DialogFragment { getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); - unbinder = ButterKnife.bind(this, view); + wizardDialogDeliverButton = (Button) view.findViewById(R.id.treatments_wizard_deliverButton); + wizardDialogDeliverButton.setOnClickListener(this); + bg = (TextView) view.findViewById(R.id.treatments_wizard_bg); + bgInsulin = (TextView) view.findViewById(R.id.treatments_wizard_bginsulin); + bgUnits = (TextView) view.findViewById(R.id.treatments_wizard_bgunits); + carbs = (TextView) view.findViewById(R.id.treatments_wizard_carbs); + carbsInsulin = (TextView) view.findViewById(R.id.treatments_wizard_carbsinsulin); + bolusIobInsulin = (TextView) view.findViewById(R.id.treatments_wizard_bolusiobinsulin); + basalIobInsulin = (TextView) view.findViewById(R.id.treatments_wizard_basaliobinsulin); + correctionInsulin = (TextView) view.findViewById(R.id.treatments_wizard_correctioninsulin); + total = (TextView) view.findViewById(R.id.treatments_wizard_total); + totalInsulin = (TextView) view.findViewById(R.id.treatments_wizard_totalinsulin); + carbTimeEdit = (EditText) view.findViewById(R.id.treatments_wizard_carbtimeinput); + superbolus = (TextView) view.findViewById(R.id.treatments_wizard_sb); + superbolusInsulin = (TextView) view.findViewById(R.id.treatments_wizard_sbinsulin); + + bgTrend = (TextView) view.findViewById(R.id.treatments_wizard_bgtrend); + bgTrendInsulin = (TextView) view.findViewById(R.id.treatments_wizard_bgtrendinsulin); + cobLayout = (LinearLayout) view.findViewById(R.id.treatments_wizard_cob_layout); + cob = (TextView) view.findViewById(R.id.treatments_wizard_cob);; + cobInsulin = (TextView) view.findViewById(R.id.treatments_wizard_cobinsulin);; + + bgCheckbox = (CheckBox) view.findViewById(R.id.treatments_wizard_bgcheckbox); + bolusIobCheckbox = (CheckBox) view.findViewById(R.id.treatments_wizard_bolusiobcheckbox); + basalIobCheckbox = (CheckBox) view.findViewById(R.id.treatments_wizard_basaliobcheckbox); + superbolusCheckbox = (CheckBox) view.findViewById(R.id.treatments_wizard_sbcheckbox); + bgtrendCheckbox = (CheckBox) view.findViewById(R.id.treatments_wizard_bgtrendcheckbox); + cobCheckbox = (CheckBox) view.findViewById(R.id.treatments_wizard_cobcheckbox); + bgCheckbox.setOnCheckedChangeListener(this); + basalIobCheckbox.setOnCheckedChangeListener(this); + bolusIobCheckbox.setOnCheckedChangeListener(this); + superbolusCheckbox.setOnCheckedChangeListener(this); + bgtrendCheckbox.setOnCheckedChangeListener(this); + cobCheckbox.setOnCheckedChangeListener(this); + + profileSpinner = (Spinner) view.findViewById(R.id.treatments_wizard_profile); + profileSpinner.setOnItemSelectedListener(this); + + correctionInput = (TextView) view.findViewById(R.id.treatments_wizard_correctioninput); + carbsInput = (TextView) view.findViewById(R.id.treatments_wizard_carbsinput); + bgInput = (TextView) view.findViewById(R.id.treatments_wizard_bginput); correctionInput.addTextChangedListener(textWatcher); carbsInput.addTextChangedListener(textWatcher); bgInput.addTextChangedListener(textWatcher); @@ -261,102 +255,105 @@ public class WizardDialog extends DialogFragment { return view; } - @OnCheckedChanged({R.id.treatments_wizard_bgcheckbox, R.id.treatments_wizard_bolusiobcheckbox, R.id.treatments_wizard_basaliobcheckbox, R.id.treatments_wizard_sbcheckbox, R.id.treatments_wizard_cobcheckbox, R.id.treatments_wizard_bgtrendcheckbox}) - public void checkboxToggled(boolean isChecked) { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { calculateInsulin(); } - @OnItemSelected(R.id.treatments_wizard_profile) - public void profileSelected(int position) { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { calculateInsulin(); wizardDialogDeliverButton.setVisibility(View.VISIBLE); } - @OnItemSelected(value = R.id.treatments_wizard_profile, - callback = NOTHING_SELECTED) - public void profileNotSelected() { + @Override + public void onNothingSelected(AdapterView parent) { ToastUtils.showToastInUiThread(context, MainApp.sResources.getString(R.string.noprofileselected)); wizardDialogDeliverButton.setVisibility(View.GONE); } - @OnClick(R.id.treatments_wizard_deliverButton) + @Override public void onClick(View view) { - if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) { - DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00"); - String confirmMessage = getString(R.string.entertreatmentquestion); + switch (view.getId()) { + case R.id.treatments_wizard_deliverButton: + if (calculatedTotalInsulin > 0d || calculatedCarbs > 0d) { + DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00"); + String confirmMessage = getString(R.string.entertreatmentquestion); - Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(calculatedTotalInsulin); - Integer carbsAfterConstraints = MainApp.getConfigBuilder().applyCarbsConstraints(calculatedCarbs); + Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(calculatedTotalInsulin); + Integer carbsAfterConstraints = MainApp.getConfigBuilder().applyCarbsConstraints(calculatedCarbs); - confirmMessage += "\n" + getString(R.string.bolus) + ": " + formatNumber2decimalplaces.format(insulinAfterConstraints) + "U"; - confirmMessage += "\n" + getString(R.string.carbs) + ": " + carbsAfterConstraints + "g"; + confirmMessage += "\n" + getString(R.string.bolus) + ": " + formatNumber2decimalplaces.format(insulinAfterConstraints) + "U"; + confirmMessage += "\n" + getString(R.string.carbs) + ": " + carbsAfterConstraints + "g"; - if (insulinAfterConstraints - calculatedTotalInsulin != 0 || !carbsAfterConstraints.equals(calculatedCarbs)) { - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror)); - builder.setMessage(getString(R.string.constraints_violation) + "\n" + getString(R.string.changeyourinput)); - builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null); - builder.show(); - return; - } - - final Double finalInsulinAfterConstraints = insulinAfterConstraints; - final Integer finalCarbsAfterConstraints = carbsAfterConstraints; - final Double bg = SafeParse.stringToDouble(bgInput.getText().toString()); - final int carbTime = SafeParse.stringToInt(carbTimeEdit.getText().toString()); - final boolean useSuperBolus = superbolusCheckbox.isChecked(); - - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(MainApp.sResources.getString(R.string.confirmation)); - builder.setMessage(confirmMessage); - builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) { - final ConfigBuilderPlugin pump = MainApp.getConfigBuilder(); - mHandler.post(new Runnable() { - @Override - public void run() { - PumpEnactResult result = pump.deliverTreatmentFromBolusWizard( - MainApp.getConfigBuilder().getActiveInsulin(), - context, - finalInsulinAfterConstraints, - finalCarbsAfterConstraints, - bg, - "Manual", - carbTime, - boluscalcJSON - ); - if (!result.success) { - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror)); - builder.setMessage(result.comment); - builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null); - builder.show(); - } - if (useSuperBolus) { - final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop(); - result = pump.setTempBasalAbsolute(0d, 120); - if (!result.success) { - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(MainApp.sResources.getString(R.string.tempbasaldeliveryerror)); - builder.setMessage(result.comment); - builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null); - builder.show(); - } - if (activeloop != null) { - activeloop.superBolusTo(new Date().getTime() + 2 * 60L * 60 * 1000); - MainApp.bus().post(new EventRefreshGui(false)); - } - } - } - }); - Answers.getInstance().logCustom(new CustomEvent("Wizard")); + if (insulinAfterConstraints - calculatedTotalInsulin != 0 || !carbsAfterConstraints.equals(calculatedCarbs)) { + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror)); + builder.setMessage(getString(R.string.constraints_violation) + "\n" + getString(R.string.changeyourinput)); + builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null); + builder.show(); + return; } + + final Double finalInsulinAfterConstraints = insulinAfterConstraints; + final Integer finalCarbsAfterConstraints = carbsAfterConstraints; + final Double bg = SafeParse.stringToDouble(bgInput.getText().toString()); + final int carbTime = SafeParse.stringToInt(carbTimeEdit.getText().toString()); + final boolean useSuperBolus = superbolusCheckbox.isChecked(); + + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle(MainApp.sResources.getString(R.string.confirmation)); + builder.setMessage(confirmMessage); + builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) { + final ConfigBuilderPlugin pump = MainApp.getConfigBuilder(); + mHandler.post(new Runnable() { + @Override + public void run() { + PumpEnactResult result = pump.deliverTreatmentFromBolusWizard( + MainApp.getConfigBuilder().getActiveInsulin(), + context, + finalInsulinAfterConstraints, + finalCarbsAfterConstraints, + bg, + "Manual", + carbTime, + boluscalcJSON + ); + if (!result.success) { + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror)); + builder.setMessage(result.comment); + builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null); + builder.show(); + } + if (useSuperBolus) { + final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop(); + result = pump.setTempBasalAbsolute(0d, 120); + if (!result.success) { + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle(MainApp.sResources.getString(R.string.tempbasaldeliveryerror)); + builder.setMessage(result.comment); + builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null); + builder.show(); + } + if (activeloop != null) { + activeloop.superBolusTo(new Date().getTime() + 2 * 60L * 60 * 1000); + MainApp.bus().post(new EventRefreshGui(false)); + } + } + } + }); + Answers.getInstance().logCustom(new CustomEvent("Wizard")); + } + } + }); + builder.setNegativeButton(getString(R.string.cancel), null); + builder.show(); + dismiss(); } - }); - builder.setNegativeButton(getString(R.string.cancel), null); - builder.show(); - dismiss(); + break; } } @@ -575,4 +572,5 @@ public class WizardDialog extends DialogFragment { e.printStackTrace(); } } + } 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 c37177c91f..c6eaadc4ab 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 @@ -31,6 +31,8 @@ import android.widget.TextView; import com.crashlytics.android.answers.Answers; import com.crashlytics.android.answers.CustomEvent; import com.jjoe64.graphview.GraphView; +import com.jjoe64.graphview.LabelFormatter; +import com.jjoe64.graphview.Viewport; import com.jjoe64.graphview.series.DataPoint; import com.jjoe64.graphview.series.LineGraphSeries; import com.jjoe64.graphview.series.PointsGraphSeries; @@ -1133,10 +1135,18 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, bgGraph.getSecondScale().addSeries(basalsLineSeries); bgGraph.getSecondScale().setMinY(0); bgGraph.getSecondScale().setMaxY(maxBgValue / lowLine * maxBasalValueFound * 1.2d); - bgGraph.getGridLabelRenderer().setVerticalLabelsSecondScaleColor(ContextCompat.getColor(MainApp.instance(), R.color.background_material_dark)); // same color as backround = hide } + bgGraph.getSecondScale().setLabelFormatter(new LabelFormatter() { + @Override + public String formatLabel(double value, boolean isValueX) { + return ""; + } - //updatePumpStatus(null); + @Override + public void setViewport(Viewport viewport) { + + } + }); } //Notifications diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationFragment.java new file mode 100644 index 0000000000..78e7791c2d --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationFragment.java @@ -0,0 +1,12 @@ +package info.nightscout.androidaps.plugins.Persistentnotification; + +import android.support.v4.app.Fragment; + +/** + * Created by adrian on 23/12/16. + */ + +public class PersistentNotificationFragment extends Fragment { + + +} 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 similarity index 99% rename from app/src/main/java/info/nightscout/androidaps/plugins/persistentnotification/PersistentNotificationPlugin.java rename to app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java index a229d906e8..f36e490e28 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 @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.persistentnotification; +package info.nightscout.androidaps.plugins.Persistentnotification; import android.app.NotificationManager; import android.app.PendingIntent; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfileFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfileFragment.java index 412e06c1ef..7ae97a17b5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfileFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileCircadianPercentage/CircadianPercentageProfileFragment.java @@ -33,14 +33,13 @@ import org.slf4j.LoggerFactory; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventInitializationChanged; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog; import info.nightscout.androidaps.plugins.Careportal.OptionsToShow; import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.SafeParse; -public class CircadianPercentageProfileFragment extends Fragment implements FragmentBase { +public class CircadianPercentageProfileFragment extends Fragment { private static Logger log = LoggerFactory.getLogger(CircadianPercentageProfileFragment.class); private static CircadianPercentageProfilePlugin circadianPercentageProfilePlugin = new CircadianPercentageProfilePlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfileFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfileFragment.java index 0d39351bff..86a983ae17 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfileFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileLocal/LocalProfileFragment.java @@ -23,14 +23,13 @@ import java.text.DecimalFormat; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventInitializationChanged; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog; import info.nightscout.androidaps.plugins.Careportal.OptionsToShow; import info.nightscout.utils.SafeParse; import info.nightscout.utils.TimeListEdit; -public class LocalProfileFragment extends Fragment implements FragmentBase { +public class LocalProfileFragment extends Fragment { private static Logger log = LoggerFactory.getLogger(LocalProfileFragment.class); private static LocalProfilePlugin localProfilePlugin = new LocalProfilePlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfileFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfileFragment.java index 8ee7a5091c..028ef1ac45 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfileFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileNS/NSProfileFragment.java @@ -12,11 +12,10 @@ import com.squareup.otto.Subscribe; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.ProfileNS.events.EventNSProfileUpdateGUI; import info.nightscout.utils.DecimalFormatter; -public class NSProfileFragment extends Fragment implements FragmentBase { +public class NSProfileFragment extends Fragment { private static NSProfilePlugin nsProfilePlugin = new NSProfilePlugin(); public static NSProfilePlugin getPlugin() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfileFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfileFragment.java index 153613d7e4..b183b28a0b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfileFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ProfileSimple/SimpleProfileFragment.java @@ -21,13 +21,12 @@ import org.slf4j.LoggerFactory; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventInitializationChanged; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog; import info.nightscout.androidaps.plugins.Careportal.OptionsToShow; import info.nightscout.utils.SafeParse; -public class SimpleProfileFragment extends Fragment implements FragmentBase { +public class SimpleProfileFragment extends Fragment { private static Logger log = LoggerFactory.getLogger(SimpleProfileFragment.class); private static SimpleProfilePlugin simpleProfilePlugin = new SimpleProfilePlugin(); 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 29b82afdfb..4aed68baec 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 @@ -26,7 +26,6 @@ import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventTempBasalChange; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog; import info.nightscout.androidaps.plugins.PumpDanaR.History.DanaRHistoryActivity; import info.nightscout.androidaps.plugins.PumpDanaR.History.DanaRStatsActivity; @@ -35,13 +34,13 @@ import info.nightscout.utils.DateUtil; import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.SetWarnColor; -public class DanaRFragment extends Fragment implements FragmentBase { +public class DanaRFragment extends Fragment { private static Logger log = LoggerFactory.getLogger(DanaRFragment.class); private static DanaRPlugin danaRPlugin; public static DanaRPlugin getPlugin() { - if(danaRPlugin==null){ + if (danaRPlugin == null) { danaRPlugin = new DanaRPlugin(); } return danaRPlugin; @@ -211,7 +210,7 @@ public class DanaRFragment extends Fragment implements FragmentBase { } if (pump.lastBolusTime.getTime() != 0) { Long agoMsec = new Date().getTime() - pump.lastBolusTime.getTime(); - double agoHours = agoMsec / 60d / 60d / 1000d; + double agoHours = agoMsec / 60d / 60d / 1000d; if (agoHours < 6) // max 6h back lastBolusView.setText(DateUtil.timeString(pump.lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + MainApp.sResources.getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(getPlugin().getDanaRPump().lastBolusAmount) + " U"); else lastBolusView.setText(""); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java index 87421877e6..bafe3f63ff 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java @@ -26,7 +26,6 @@ import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventPumpStatusChanged; import info.nightscout.androidaps.events.EventTempBasalChange; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog; import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus; import info.nightscout.androidaps.plugins.PumpDanaRKorean.History.DanaRHistoryActivity; @@ -35,7 +34,7 @@ import info.nightscout.utils.DateUtil; import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.SetWarnColor; -public class DanaRKoreanFragment extends Fragment implements FragmentBase { +public class DanaRKoreanFragment extends Fragment { private static Logger log = LoggerFactory.getLogger(DanaRKoreanFragment.class); private static DanaRKoreanPlugin danaRKoreanPlugin = new DanaRKoreanPlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIFragment.java index 47e6d2beda..f6221d627e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIFragment.java @@ -3,14 +3,7 @@ package info.nightscout.androidaps.plugins.PumpMDI; import android.support.v4.app.Fragment; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import info.nightscout.androidaps.interfaces.FragmentBase; - -public class MDIFragment extends Fragment implements FragmentBase { - private static Logger log = LoggerFactory.getLogger(MDIFragment.class); - +public class MDIFragment extends Fragment { private static MDIPlugin mdiPlugin = new MDIPlugin(); public static MDIPlugin getPlugin() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java index c77ed3a0da..edad845092 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java @@ -18,10 +18,9 @@ import org.slf4j.LoggerFactory; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui; -public class VirtualPumpFragment extends Fragment implements FragmentBase { +public class VirtualPumpFragment extends Fragment { private static Logger log = LoggerFactory.getLogger(VirtualPumpFragment.class); private static VirtualPumpPlugin virtualPumpPlugin = new VirtualPumpPlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SourceGlimp/SourceGlimpFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/SourceGlimp/SourceGlimpFragment.java index 85a4ee9646..63ab27deee 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SourceGlimp/SourceGlimpFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SourceGlimp/SourceGlimpFragment.java @@ -3,9 +3,7 @@ package info.nightscout.androidaps.plugins.SourceGlimp; import android.support.v4.app.Fragment; -import info.nightscout.androidaps.interfaces.FragmentBase; - -public class SourceGlimpFragment extends Fragment implements FragmentBase { +public class SourceGlimpFragment extends Fragment { private static SourceGlimpPlugin sourceGlimpPlugin = new SourceGlimpPlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SourceMM640g/SourceMM640gFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/SourceMM640g/SourceMM640gFragment.java index f43dc6ada7..28bfabf813 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SourceMM640g/SourceMM640gFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SourceMM640g/SourceMM640gFragment.java @@ -3,9 +3,7 @@ package info.nightscout.androidaps.plugins.SourceMM640g; import android.support.v4.app.Fragment; -import info.nightscout.androidaps.interfaces.FragmentBase; - -public class SourceMM640gFragment extends Fragment implements FragmentBase { +public class SourceMM640gFragment extends Fragment { private static SourceMM640gPlugin sourceMM640gPlugin = new SourceMM640gPlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SourceNSClient/SourceNSClientFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/SourceNSClient/SourceNSClientFragment.java index c119952112..b2eddc09fc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SourceNSClient/SourceNSClientFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SourceNSClient/SourceNSClientFragment.java @@ -3,9 +3,7 @@ package info.nightscout.androidaps.plugins.SourceNSClient; import android.support.v4.app.Fragment; -import info.nightscout.androidaps.interfaces.FragmentBase; - -public class SourceNSClientFragment extends Fragment implements FragmentBase { +public class SourceNSClientFragment extends Fragment { private static SourceNSClientPlugin sourceNSClientPlugin = new SourceNSClientPlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SourceXdrip/SourceXdripFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/SourceXdrip/SourceXdripFragment.java index e3c58f4bf8..c9be1298d2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SourceXdrip/SourceXdripFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SourceXdrip/SourceXdripFragment.java @@ -3,9 +3,7 @@ package info.nightscout.androidaps.plugins.SourceXdrip; import android.support.v4.app.Fragment; -import info.nightscout.androidaps.interfaces.FragmentBase; - -public class SourceXdripFragment extends Fragment implements FragmentBase { +public class SourceXdripFragment extends Fragment { private static SourceXdripPlugin sourceXdripPlugin = new SourceXdripPlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsFragment.java index 8317623fd2..fbe946dc03 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsFragment.java @@ -26,12 +26,11 @@ import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.events.EventTempBasalChange; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.utils.DateUtil; import info.nightscout.utils.DecimalFormatter; -public class TempBasalsFragment extends Fragment implements FragmentBase { +public class TempBasalsFragment extends Fragment { private static Logger log = LoggerFactory.getLogger(TempBasalsFragment.class); private static TempBasalsPlugin tempBasalsPlugin = new TempBasalsPlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/TempTargetRange/TempTargetRangeFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/TempTargetRange/TempTargetRangeFragment.java index f9e979ae45..13cae1aad0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/TempTargetRange/TempTargetRangeFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/TempTargetRange/TempTargetRangeFragment.java @@ -31,10 +31,9 @@ import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.db.TempTarget; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; -import info.nightscout.androidaps.plugins.TempTargetRange.events.EventTempTargetRangeChange; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile; +import info.nightscout.androidaps.plugins.TempTargetRange.events.EventTempTargetRangeChange; import info.nightscout.utils.DateUtil; import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.ToastUtils; @@ -43,7 +42,7 @@ import info.nightscout.utils.ToastUtils; * Created by mike on 13/01/17. */ -public class TempTargetRangeFragment extends Fragment implements View.OnClickListener, FragmentBase { +public class TempTargetRangeFragment extends Fragment implements View.OnClickListener { private static TempTargetRangePlugin tempTargetRangePlugin = new TempTargetRangePlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsFragment.java index f1539c4e4c..10bc2ff856 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsFragment.java @@ -37,14 +37,13 @@ import info.nightscout.androidaps.Services.Intents; import info.nightscout.androidaps.data.Iob; import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.events.EventTreatmentChange; -import info.nightscout.androidaps.interfaces.FragmentBase; import info.nightscout.androidaps.interfaces.InsulinInterface; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile; import info.nightscout.utils.DateUtil; import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.ToastUtils; -public class TreatmentsFragment extends Fragment implements View.OnClickListener, FragmentBase { +public class TreatmentsFragment extends Fragment implements View.OnClickListener { private static Logger log = LoggerFactory.getLogger(TreatmentsFragment.class); private static TreatmentsPlugin treatmentsPlugin = new TreatmentsPlugin(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearFragment.java index 8f4e7f9be2..d243da7d60 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/WearFragment.java @@ -8,19 +8,18 @@ import android.view.View; import android.view.ViewGroup; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.FragmentBase; /** * Created by adrian on 17/11/16. */ -public class WearFragment extends Fragment implements FragmentBase { +public class WearFragment extends Fragment { private static WearPlugin wearPlugin; public static WearPlugin getPlugin(Context ctx) { - if (wearPlugin == null){ + if (wearPlugin == null) { wearPlugin = new WearPlugin(ctx); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/persistentnotification/PersistentNotificationFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/persistentnotification/PersistentNotificationFragment.java deleted file mode 100644 index 6834124167..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/persistentnotification/PersistentNotificationFragment.java +++ /dev/null @@ -1,14 +0,0 @@ -package info.nightscout.androidaps.plugins.persistentnotification; - -import android.support.v4.app.Fragment; - -import info.nightscout.androidaps.interfaces.FragmentBase; - -/** - * Created by adrian on 23/12/16. - */ - -public class PersistentNotificationFragment extends Fragment implements FragmentBase { - - -} diff --git a/app/src/main/res/layout/overview_fragment.xml b/app/src/main/res/layout/overview_fragment.xml index 262775daa3..15f72f6bc0 100644 --- a/app/src/main/res/layout/overview_fragment.xml +++ b/app/src/main/res/layout/overview_fragment.xml @@ -192,32 +192,41 @@ android:layout_gravity="center_horizontal" android:textAppearance="?android:attr/textAppearanceSmall" /> - + android:layout_height="wrap_content" + android:orientation="horizontal"> - - + android:layout_height="160dip" + android:layout_weight="1" /> - - + android:layout_height="match_parent" + android:orientation="vertical"> + + + + + + +