CPP edit base basal gui - without function yet

This commit is contained in:
AdrianLxM 2016-11-13 17:45:47 +01:00
parent dba81ede2a
commit c2d1fdb39e
10 changed files with 157 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -1,9 +1,13 @@
package info.nightscout.androidaps.plugins.CircadianPercentageProfile;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.text.Editable;
import android.text.Html;
import android.text.TextWatcher;
@ -14,16 +18,19 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Text;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.FragmentBase;
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;
import info.nightscout.utils.ToastUtils;
@ -51,6 +58,10 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
Button profileswitchButton;
ImageView percentageIcon;
ImageView timeIcon;
ImageView basaleditIcon;
ImageView iceditIcon;
ImageView isfeditIcon;
@ -74,6 +85,12 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
timeIcon = (ImageView) layout.findViewById(R.id.circadianpercentageprofile_timeicon);
profileswitchButton = (Button) layout.findViewById(R.id.circadianpercentageprofile_profileswitch);
basaleditIcon = (ImageView) layout.findViewById(R.id.circadianpercentageprofile_basaledit);
iceditIcon = (ImageView) layout.findViewById(R.id.circadianpercentageprofile_icedit);
isfeditIcon = (ImageView) layout.findViewById(R.id.circadianpercentageprofile_isfedit);
mgdlView.setChecked(circadianPercentageProfilePlugin.mgdl);
mmolView.setChecked(circadianPercentageProfilePlugin.mmol);
diaView.setText(circadianPercentageProfilePlugin.dia.toString());
@ -153,6 +170,14 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
}
});
basaleditIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
BasalEditDialog basalEditDialog = new BasalEditDialog();
basalEditDialog.show(getFragmentManager(), "Edit Basal");
}
});
TextWatcher textWatch = new TextWatcher() {
@ -209,4 +234,36 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
baseprofileISF.setText(Html.fromHtml("<h4>ISF: </h4>" + circadianPercentageProfilePlugin.baseIsfString()));
}
private class BasalEditDialog extends DialogFragment{
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
getDialog().setTitle("Edit Base-Basal rates: ");
View view = inflater.inflate(R.layout.circadianpercentageprofile_editbasal_dialog, container, false);
LinearLayout list = (LinearLayout) view.findViewById(R.id.circadianpp_editbasal_listlayout);
for (int i = 0; i < 24; i++) {
View childview = inflater.inflate(R.layout.circadianpercentageprofile_listelement, container, false);
((TextView)childview.findViewById(R.id.basal_time_elem)).setText((i<10?"0":"") + i + ":00: ");
if(i==0){
(childview.findViewById(R.id.basal_copyprev_elem)).setVisibility(View.INVISIBLE);;
} else {
//TODO: Add listener
}
//TODO: safe EditTexts in array for prev buttonaction!
((TextView)childview.findViewById(R.id.basal_edittext_elem)).setText(DecimalFormatter.to2Decimal(getPlugin().basebasal[i]));
list.addView(childview);
}
getDialog().setCancelable(true);
return view;
}
}
}

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:padding="10dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<LinearLayout
android:id="@+id/circadianpp_editbasal_listlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Insert elements programmatically -->
</LinearLayout>
</ScrollView>
<View
android:id="@+id/fill_preset_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:orientation="horizontal"
android:padding="10dp"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal">
<Button
android:id="@+id/fill_preset_button2"
style="?android:attr/buttonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:padding="10dp"
android:text="CANCEL"
android:textSize="20sp" />
<Button
android:id="@+id/fill_preset_button3"
style="?android:attr/buttonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:padding="10dp"
android:text="OK"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>

View file

@ -124,6 +124,7 @@
android:layout_weight="1"/>
<ImageView
android:id="@+id/circadianpercentageprofile_basaledit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_edit"
@ -151,6 +152,7 @@
android:layout_weight="1"/>
<ImageView
android:id="@+id/circadianpercentageprofile_icedit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_edit"
@ -174,6 +176,7 @@
android:layout_weight="1"/>
<ImageView
android:id="@+id/circadianpercentageprofile_isfedit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_edit"

View file

@ -0,0 +1,31 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/cardColorBackground"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:gravity="center_horizontal">
<TextView
android:id="@+id/basal_time_elem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/cardColorBackground"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText
android:id="@+id/basal_edittext_elem"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:layout_marginLeft="15dp"/>
<ImageView
android:id="@+id/basal_copyprev_elem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:src="@mipmap/ic_copyprev"
android:layout_marginLeft="15dp"/>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB