fix wizard gui

This commit is contained in:
Milos Kozak 2016-08-11 09:54:03 +02:00
parent 4b388da5a3
commit 4da0f345cf
3 changed files with 18 additions and 1 deletions

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View file

@ -15,6 +15,7 @@ import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
@ -110,6 +111,20 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
}
};
final AdapterView.OnItemSelectedListener onItemSelectedListener = new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
calculateInsulin();
wizardDialogDeliverButton.setVisibility(View.VISIBLE);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
ToastUtils.showToastInUiThread(getContext(), MainApp.sResources.getString(R.string.noprofileselected));
wizardDialogDeliverButton.setVisibility(View.GONE);
}
};
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@ -148,6 +163,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
bgCheckbox.setOnCheckedChangeListener(onCheckedChangeListener);
basalIobCheckbox.setOnCheckedChangeListener(onCheckedChangeListener);
bolusIobCheckbox.setOnCheckedChangeListener(onCheckedChangeListener);
profileSpinner.setOnItemSelectedListener(onItemSelectedListener);
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
Double maxCorrection = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);

View file

@ -304,5 +304,6 @@
<string name="objectives_6_objective">Enabling additional features for daytime use, such as advanced meal assist</string>
<string name="youareonallowedlimit">You reached allowed limit</string>
<string name="openapsma_target_bg">Target value for calculations</string>
<string name="noprofileselected">No profile seselcted</string>
</resources>