show upload profile button only when pump is capable to this
This commit is contained in:
parent
b2be49e631
commit
2f52091b67
3 changed files with 57 additions and 25 deletions
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.CircadianPercentageProfile;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
|
@ -19,10 +20,14 @@ import android.widget.LinearLayout;
|
|||
import android.widget.RadioButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
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.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
|
@ -60,8 +65,6 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
|||
BasalEditDialog basalEditDialog;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
@ -87,7 +90,6 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
|||
isfeditIcon = (ImageView) layout.findViewById(R.id.circadianpercentageprofile_isfedit);
|
||||
|
||||
|
||||
|
||||
mgdlView.setChecked(circadianPercentageProfilePlugin.mgdl);
|
||||
mmolView.setChecked(circadianPercentageProfilePlugin.mmol);
|
||||
diaView.setText(circadianPercentageProfilePlugin.dia.toString());
|
||||
|
@ -232,6 +234,8 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
|||
percentageView.addTextChangedListener(textWatch);
|
||||
timeshiftView.addTextChangedListener(textWatch);
|
||||
|
||||
onStatusEvent(null);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
|
@ -294,7 +298,8 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
|||
ImageView copyprevbutton = (ImageView) childview.findViewById(R.id.basal_copyprev_elem);
|
||||
|
||||
if (i == 0) {
|
||||
copyprevbutton.setVisibility(View.INVISIBLE);;
|
||||
copyprevbutton.setVisibility(View.INVISIBLE);
|
||||
;
|
||||
} else {
|
||||
final int j = i; //needs to be final to be passed to inner class.
|
||||
copyprevbutton.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -334,11 +339,34 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
|||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
onStatusEvent(null);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventInitializationChanged e) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!MainApp.getConfigBuilder().isInitialized() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||
profileswitchButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
profileswitchButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class MDIPlugin implements PluginBase, PumpInterface {
|
|||
pumpDescription.highTempPercentDuration = 0;
|
||||
pumpDescription.highTempAbsoluteDuration = 0;
|
||||
|
||||
pumpDescription.isSetBasalProfileCapable = true;
|
||||
pumpDescription.isSetBasalProfileCapable = false;
|
||||
pumpDescription.basalStep = 0d;
|
||||
pumpDescription.basalMinimumRate = 0d;
|
||||
|
||||
|
|
|
@ -136,6 +136,9 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
|
|||
basalView.addTextChangedListener(textWatch);
|
||||
targetlowView.addTextChangedListener(textWatch);
|
||||
targethighView.addTextChangedListener(textWatch);
|
||||
|
||||
onStatusEvent(null);
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
|
@ -149,6 +152,7 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
|
|||
public void onResume() {
|
||||
super.onResume();
|
||||
MainApp.bus().register(this);
|
||||
onStatusEvent(null);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -158,7 +162,7 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!MainApp.getConfigBuilder().isInitialized()) {
|
||||
if (!MainApp.getConfigBuilder().isInitialized() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||
profileswitchButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
profileswitchButton.setVisibility(View.VISIBLE);
|
||||
|
|
Loading…
Reference in a new issue