CPP cleanup and i18n

This commit is contained in:
AdrianLxM 2016-11-14 18:11:26 +01:00
parent 74ea6c4011
commit 513b2966c9
6 changed files with 148 additions and 132 deletions

View file

@ -65,12 +65,12 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.circadianpercentageprofile_fragment, container, false); View layout = inflater.inflate(R.layout.circadianpercentageprofile_fragment, container, false);
diaView = (EditText) layout.findViewById(R.id.simpleprofile_dia); diaView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_dia);
mgdlView = (RadioButton) layout.findViewById(R.id.simpleprofile_mgdl); mgdlView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mgdl);
mmolView = (RadioButton) layout.findViewById(R.id.simpleprofile_mmol); mmolView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mmol);
carView = (EditText) layout.findViewById(R.id.simpleprofile_car); carView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_car);
targetlowView = (EditText) layout.findViewById(R.id.simpleprofile_targetlow); targetlowView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_targetlow);
targethighView = (EditText) layout.findViewById(R.id.simpleprofile_targethigh); targethighView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_targethigh);
percentageView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_percentage); percentageView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_percentage);
timeshiftView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_timeshift); timeshiftView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_timeshift);
profileView = (TextView) layout.findViewById(R.id.circadianpercentageprofile_profileview); profileView = (TextView) layout.findViewById(R.id.circadianpercentageprofile_profileview);
@ -133,7 +133,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
@Override @Override
public void onFocusChange(View view, boolean b) { public void onFocusChange(View view, boolean b) {
if(b) if(b)
ToastUtils.showToastInUiThread(getContext(), "Time in hours by which the profile will be shifted round robin."); ToastUtils.showToastInUiThread(getContext(), getString(R.string.timeshift_hint));
} }
}); });
@ -142,7 +142,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
@Override @Override
public void onFocusChange(View view, boolean b) { public void onFocusChange(View view, boolean b) {
if(b) if(b)
ToastUtils.showToastInUiThread(getContext(), "Percentage factor by which the base profile will be multiplied."); ToastUtils.showToastInUiThread(getContext(), getString(R.string.percentagefactor_hint));
} }
}); });
@ -169,24 +169,24 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
basaleditIcon.setOnClickListener(new View.OnClickListener() { basaleditIcon.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
BasalEditDialog basalEditDialog = new BasalEditDialog(getPlugin().basebasal, "Edit Base-Basal:"); BasalEditDialog basalEditDialog = new BasalEditDialog(getPlugin().basebasal, getString(R.string.edit_base_basal));
basalEditDialog.show(getFragmentManager(), "Edit Basal"); basalEditDialog.show(getFragmentManager(), getString(R.string.edit_base_basal));
} }
}); });
isfeditIcon.setOnClickListener(new View.OnClickListener() { isfeditIcon.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
BasalEditDialog basalEditDialog = new BasalEditDialog(getPlugin().baseisf, "Edit Base-ISF:"); BasalEditDialog basalEditDialog = new BasalEditDialog(getPlugin().baseisf, getString(R.string.edit_base_isf));
basalEditDialog.show(getFragmentManager(), "Edit ISF"); basalEditDialog.show(getFragmentManager(), getString(R.string.edit_base_isf));
} }
}); });
iceditIcon.setOnClickListener(new View.OnClickListener() { iceditIcon.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
BasalEditDialog basalEditDialog = new BasalEditDialog(getPlugin().baseic, "Edit Base-IC:"); BasalEditDialog basalEditDialog = new BasalEditDialog(getPlugin().baseic, getString(R.string.edit_base_ic));
basalEditDialog.show(getFragmentManager(), "Edit IC"); basalEditDialog.show(getFragmentManager(), getString(R.string.edit_base_ic));
} }
}); });
@ -234,16 +234,23 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
private void updateProfileInfo() { private void updateProfileInfo() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("<h3>"); sb.append("<h3>");
sb.append("Active Profile:"); sb.append(getString(R.string.nsprofileview_activeprofile_label));
sb.append("</h3>"); sb.append("</h3>");
sb.append("<h4>Basal:</h4> " + circadianPercentageProfilePlugin.basalString()); sb.append("<h4>");
sb.append("<h4>IC:</h4> " + circadianPercentageProfilePlugin.icString()); sb.append(getString(R.string.nsprofileview_basal_label));
sb.append("<h4>ISF:</h4> " + circadianPercentageProfilePlugin.isfString()); sb.append("</h4> " + circadianPercentageProfilePlugin.basalString());
sb.append("<h4>");
sb.append(getString(R.string.nsprofileview_ic_label));
sb.append("</h4> " + circadianPercentageProfilePlugin.icString());
sb.append("<h4>");
sb.append(getString(R.string.nsprofileview_isf_label));
sb.append("</h4> " + circadianPercentageProfilePlugin.isfString());
profileView.setText(Html.fromHtml(sb.toString())); profileView.setText(Html.fromHtml(sb.toString()));
baseprofileBasal.setText(Html.fromHtml("<h3>Base Profile:</h3><h4>Basal: </h4>" + circadianPercentageProfilePlugin.baseBasalString())); baseprofileBasal.setText(Html.fromHtml("<h3>" + getString(R.string.base_profile_label) + "</h3>" +
baseprofileIC.setText(Html.fromHtml("<h4>IC: </h4>" + circadianPercentageProfilePlugin.baseIcString())); "<h4>" + getString(R.string.nsprofileview_basal_label) + "</h4>" + circadianPercentageProfilePlugin.baseBasalString()));
baseprofileISF.setText(Html.fromHtml("<h4>ISF: </h4>" + circadianPercentageProfilePlugin.baseIsfString())); baseprofileIC.setText(Html.fromHtml("<h4>" + getString(R.string.nsprofileview_ic_label) + "</h4>" + circadianPercentageProfilePlugin.baseIcString()));
baseprofileISF.setText(Html.fromHtml("<h4>" + getString(R.string.nsprofileview_isf_label) + "</h4>" + circadianPercentageProfilePlugin.baseIsfString()));
} }
private class BasalEditDialog extends DialogFragment{ private class BasalEditDialog extends DialogFragment{
@ -307,7 +314,6 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
} }
}); });
return view; return view;
} }

View file

@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.ProfileInterface; import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.client.data.NSProfile; import info.nightscout.client.data.NSProfile;
@ -59,9 +60,7 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
@Override @Override
public String getName() { public String getName() {
// TODO Adrian: stringify! (omitted to prevent merge conflicts) return MainApp.instance().getString(R.string.circadian_percentage_profile);
return "CPP";
//return MainApp.instance().getString(R.string.simpleprofile);
} }
@Override @Override
@ -89,7 +88,7 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
this.fragmentVisible = fragmentVisible; this.fragmentVisible = fragmentVisible;
} }
public void storeSettings() { void storeSettings() {
if (Config.logPrefsChange) if (Config.logPrefsChange)
log.debug("Storing settings"); log.debug("Storing settings");
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
@ -100,11 +99,11 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
editor.putString(SETTINGS_PREFIX + "car", car.toString()); editor.putString(SETTINGS_PREFIX + "car", car.toString());
editor.putString(SETTINGS_PREFIX + "targetlow", targetLow.toString()); editor.putString(SETTINGS_PREFIX + "targetlow", targetLow.toString());
editor.putString(SETTINGS_PREFIX + "targethigh", targetHigh.toString()); editor.putString(SETTINGS_PREFIX + "targethigh", targetHigh.toString());
editor.putString(SETTINGS_PREFIX + "timeshift", timeshift+""); editor.putString(SETTINGS_PREFIX + "timeshift", timeshift + "");
editor.putString(SETTINGS_PREFIX + "percentage", percentage+""); editor.putString(SETTINGS_PREFIX + "percentage", percentage + "");
for (int i = 0; i<24; i++) { for (int i = 0; i < 24; i++) {
editor.putString(SETTINGS_PREFIX + "basebasal" + i, DecimalFormatter.to2Decimal(basebasal[i])); editor.putString(SETTINGS_PREFIX + "basebasal" + i, DecimalFormatter.to2Decimal(basebasal[i]));
editor.putString(SETTINGS_PREFIX + "baseisf" + i, DecimalFormatter.to2Decimal(baseisf[i])); editor.putString(SETTINGS_PREFIX + "baseisf" + i, DecimalFormatter.to2Decimal(baseisf[i]));
editor.putString(SETTINGS_PREFIX + "baseic" + i, DecimalFormatter.to2Decimal(baseic[i])); editor.putString(SETTINGS_PREFIX + "baseic" + i, DecimalFormatter.to2Decimal(baseic[i]));
@ -113,12 +112,12 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
createConvertedProfile(); createConvertedProfile();
} }
private void loadSettings() { void loadSettings() {
if (Config.logPrefsChange) if (Config.logPrefsChange)
log.debug("Loading stored settings"); log.debug("Loading stored settings");
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext()); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
if (settings.contains(SETTINGS_PREFIX+ "mgdl")) if (settings.contains(SETTINGS_PREFIX + "mgdl"))
try { try {
mgdl = settings.getBoolean(SETTINGS_PREFIX + "mgdl", true); mgdl = settings.getBoolean(SETTINGS_PREFIX + "mgdl", true);
} catch (Exception e) { } catch (Exception e) {
@ -176,7 +175,7 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
} }
else timeshift = 0; else timeshift = 0;
for (int i = 0; i<24; i++){ for (int i = 0; i < 24; i++) {
try { try {
basebasal[i] = SafeParse.stringToDouble(settings.getString(SETTINGS_PREFIX + "basebasal" + i, DecimalFormatter.to2Decimal(basebasal[i]))); basebasal[i] = SafeParse.stringToDouble(settings.getString(SETTINGS_PREFIX + "basebasal" + i, DecimalFormatter.to2Decimal(basebasal[i])));
} catch (Exception e) { } catch (Exception e) {
@ -197,7 +196,8 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
createConvertedProfile(); createConvertedProfile();
} }
void createConvertedProfile() {
private void createConvertedProfile() {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
JSONObject store = new JSONObject(); JSONObject store = new JSONObject();
JSONObject profile = new JSONObject(); JSONObject profile = new JSONObject();
@ -220,25 +220,25 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
json.put("store", store); json.put("store", store);
profile.put("dia", dia); profile.put("dia", dia);
int offset = -(timeshift%24) + 24; int offset = -(timeshift % 24) + 24;
JSONArray icArray = new JSONArray(); JSONArray icArray = new JSONArray();
for (int i = 0; i<24; i++){ for (int i = 0; i < 24; i++) {
icArray.put(new JSONObject().put("timeAsSeconds", i*60*60).put("value", baseic[(offset+i)%24]*100d/percentage)); icArray.put(new JSONObject().put("timeAsSeconds", i * 60 * 60).put("value", baseic[(offset + i) % 24] * 100d / percentage));
} }
profile.put("carbratio", icArray); profile.put("carbratio", icArray);
profile.put("carbs_hr", car); profile.put("carbs_hr", car);
JSONArray isfArray = new JSONArray(); JSONArray isfArray = new JSONArray();
for (int i = 0; i<24; i++){ for (int i = 0; i < 24; i++) {
isfArray.put(new JSONObject().put("timeAsSeconds", i*60*60).put("value", baseisf[(offset+i)%24]*100d/percentage)); isfArray.put(new JSONObject().put("timeAsSeconds", i * 60 * 60).put("value", baseisf[(offset + i) % 24] * 100d / percentage));
} }
profile.put("sens", isfArray); profile.put("sens", isfArray);
JSONArray basalArray = new JSONArray(); JSONArray basalArray = new JSONArray();
for (int i = 0; i<24; i++){ for (int i = 0; i < 24; i++) {
basalArray.put(new JSONObject().put("timeAsSeconds", i*60*60).put("value", basebasal[(offset+i)%24]*percentage/100d)); basalArray.put(new JSONObject().put("timeAsSeconds", i * 60 * 60).put("value", basebasal[(offset + i) % 24] * percentage / 100d));
} }
profile.put("basal", basalArray); profile.put("basal", basalArray);
@ -258,41 +258,47 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
return convertedProfile; return convertedProfile;
} }
public String basalString() { String basalString() {
return profileString(basebasal, timeshift, percentage, true); return profileString(basebasal, timeshift, percentage, true);
} }
public String icString() { String icString() {
return profileString(baseic, timeshift, percentage, false); return profileString(baseic, timeshift, percentage, false);
} }
public String isfString() { String isfString() {
return profileString(baseisf, timeshift, percentage, false); return profileString(baseisf, timeshift, percentage, false);
} }
public String baseIcString() { String baseIcString() {
return profileString(baseic, 0, 100, false); return profileString(baseic, 0, 100, false);
} }
public String baseIsfString() { String baseIsfString() {
return profileString(baseisf, 0, 100, false); return profileString(baseisf, 0, 100, false);
} }
public String baseBasalString() { String baseBasalString() {return profileString(basebasal, 0, 100, true);}
return profileString(basebasal, 0, 100, true);
}
private static String profileString(double[] values, int timeshift, int percentage, boolean inc){
timeshift = -(timeshift%24) + 24; private static String profileString(double[] values, int timeshift, int percentage, boolean inc) {
timeshift = -(timeshift % 24) + 24;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("<b>"); sb.append(0); sb.append("h: "); sb.append("</b>"); sb.append("<b>");
sb.append(DecimalFormatter.to2Decimal(values[(timeshift+0)%24]*(inc?percentage/100d:100d/percentage))); sb.append(0);
double prevVal = values[(timeshift+0)%24]; sb.append("h: ");
sb.append("</b>");
sb.append(DecimalFormatter.to2Decimal(values[(timeshift + 0) % 24] * (inc ? percentage / 100d : 100d / percentage)));
double prevVal = values[(timeshift + 0) % 24];
for (int i = 1; i < 24; i++) { for (int i = 1; i < 24; i++) {
if(prevVal != values[(timeshift+i)%24]){ if (prevVal != values[(timeshift + i) % 24]) {
sb.append(", ");sb.append("<b>"); sb.append(i); sb.append("h: ");sb.append("</b>"); sb.append(", ");
sb.append(DecimalFormatter.to2Decimal(values[(timeshift+i)%24]*(inc?percentage/100d:100d/percentage))); sb.append("<b>");
prevVal = values[(timeshift+i)%24]; sb.append(i);
sb.append("h: ");
sb.append("</b>");
sb.append(DecimalFormatter.to2Decimal(values[(timeshift + i) % 24] * (inc ? percentage / 100d : 100d / percentage)));
prevVal = values[(timeshift + i) % 24];
} }
} }
return sb.toString(); return sb.toString();

View file

@ -6,7 +6,6 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="10dp"> android:padding="10dp">
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -20,8 +19,6 @@
<!-- Insert elements programmatically --> <!-- Insert elements programmatically -->
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<View <View
@ -33,12 +30,12 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:orientation="horizontal"
android:padding="10dp"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"> android:orientation="horizontal"
android:padding="10dp">
<Button <Button
android:id="@+id/cancel_action" android:id="@+id/cancel_action"
@ -47,7 +44,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0.3" android:layout_weight="0.3"
android:padding="10dp" android:padding="10dp"
android:text="CANCEL" android:text="@string/cancel"
android:textSize="20sp" /> android:textSize="20sp" />
<Button <Button
android:id="@+id/ok_button" android:id="@+id/ok_button"
@ -56,11 +53,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0.3" android:layout_weight="0.3"
android:padding="10dp" android:padding="10dp"
android:text="OK" android:text="@string/ok"
android:textSize="20sp" /> android:textSize="20sp" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -19,39 +19,37 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="6dp" android:layout_margin="6dp"
android:padding="6dp"
android:background="@color/cardColorBackground" android:background="@color/cardColorBackground"
android:text="Profile View" android:padding="6dp"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:layout_gravity="center_horizontal"
android:layout_gravity="center_horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:background="@drawable/pillborder" android:background="@drawable/pillborder"
android:orientation="horizontal"
android:padding="5dp"> android:padding="5dp">
<ImageView <ImageView
android:id="@+id/circadianpercentageprofile_percentageicon" android:id="@+id/circadianpercentageprofile_percentageicon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium" android:src="@mipmap/ic_percentage"
android:src="@mipmap/ic_percentage"/> android:textAppearance="?android:attr/textAppearanceMedium"/>
<EditText <EditText
android:id="@+id/circadianpercentageprofile_percentage" android:id="@+id/circadianpercentageprofile_percentage"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_column="2" android:hint="@string/percentagefactor_hint"
android:inputType="number" android:inputType="number"/>
android:hint="Percentage factor by which the base profile will be multiplied."/>
</LinearLayout> </LinearLayout>
@ -59,25 +57,24 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:background="@drawable/pillborder" android:background="@drawable/pillborder"
android:orientation="horizontal"
android:padding="5dp"> android:padding="5dp">
<ImageView <ImageView
android:id="@+id/circadianpercentageprofile_timeicon" android:id="@+id/circadianpercentageprofile_timeicon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium" android:src="@mipmap/ic_time"
android:src="@mipmap/ic_time"/> android:textAppearance="?android:attr/textAppearanceMedium"/>
<EditText <EditText
android:id="@+id/circadianpercentageprofile_timeshift" android:id="@+id/circadianpercentageprofile_timeshift"
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_column="2" android:hint="@string/timeshift_hint"
android:inputType="number" android:inputType="number"/>
android:hint="Time in hours by which the profile will be shifted round robin."/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@ -87,101 +84,101 @@
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="3dp" android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingRight="10dp" android:paddingRight="10dp"
android:text="SEND TO PUMP" android:text="@string/send_to_pump"
android:layout_gravity="center_horizontal"
android:textColor="@color/colorProfileSwitchButton" /> android:textColor="@color/colorProfileSwitchButton" />
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="6dp" android:layout_margin="6dp"
android:padding="6dp"
android:background="@color/cardColorBackground" android:background="@color/cardColorBackground"
android:orientation="vertical"
android:padding="6dp"
android:textAppearance="?android:attr/textAppearanceSmall"> android:textAppearance="?android:attr/textAppearanceSmall">
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/cardColorBackground" android:background="@color/cardColorBackground"
android:orientation="horizontal"
android:textAppearance="?android:attr/textAppearanceSmall"> android:textAppearance="?android:attr/textAppearanceSmall">
<TextView <TextView
android:id="@+id/circadianpercentageprofile_baseprofilebasal" android:id="@+id/circadianpercentageprofile_baseprofilebasal"
android:layout_height="wrap_content"
android:background="@color/cardColorBackground"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_weight="1"/> android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/cardColorBackground"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<ImageView <ImageView
android:id="@+id/circadianpercentageprofile_basaledit" android:id="@+id/circadianpercentageprofile_basaledit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@mipmap/ic_edit" android:layout_gravity="center_vertical"
android:layout_weight="0" android:layout_weight="0"
android:layout_gravity="center_vertical"/> android:src="@mipmap/ic_edit"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/cardColorBackground" android:background="@color/cardColorBackground"
android:textAppearance="?android:attr/textAppearanceSmall" android:orientation="horizontal"
android:paddingTop="5dp"> android:paddingTop="5dp"
android:textAppearance="?android:attr/textAppearanceSmall">
<TextView <TextView
android:id="@+id/circadianpercentageprofile_baseprofileic" android:id="@+id/circadianpercentageprofile_baseprofileic"
android:layout_height="wrap_content"
android:background="@color/cardColorBackground"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_weight="1"/> android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/cardColorBackground"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<ImageView <ImageView
android:id="@+id/circadianpercentageprofile_icedit" android:id="@+id/circadianpercentageprofile_icedit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@mipmap/ic_edit" android:layout_gravity="center_vertical"
android:layout_weight="0" android:layout_weight="0"
android:layout_gravity="center_vertical"/> android:src="@mipmap/ic_edit"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/cardColorBackground" android:background="@color/cardColorBackground"
android:textAppearance="?android:attr/textAppearanceSmall" android:orientation="horizontal"
android:paddingTop="5dp"> android:paddingTop="5dp"
android:textAppearance="?android:attr/textAppearanceSmall">
<TextView <TextView
android:id="@+id/circadianpercentageprofile_baseprofileisf" android:id="@+id/circadianpercentageprofile_baseprofileisf"
android:layout_height="wrap_content"
android:background="@color/cardColorBackground"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_weight="1"/> android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/cardColorBackground"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<ImageView <ImageView
android:id="@+id/circadianpercentageprofile_isfedit" android:id="@+id/circadianpercentageprofile_isfedit"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@mipmap/ic_edit" android:layout_gravity="center_vertical"
android:layout_weight="0" android:layout_weight="0"
android:layout_gravity="center_vertical"/> android:src="@mipmap/ic_edit"/>
</LinearLayout> </LinearLayout>
@ -203,23 +200,23 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Units:" android:text="@string/units"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
<RadioButton <RadioButton
android:id="@+id/simpleprofile_mgdl" android:id="@+id/circadianpercentageprofile_mgdl"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_column="2" android:layout_column="2"
android:text="mgdl" /> android:text="@string/mgdl" />
<RadioButton <RadioButton
android:id="@+id/simpleprofile_mmol" android:id="@+id/circadianpercentageprofile_mmol"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_column="3" android:layout_column="3"
android:text="mmol" /> android:text="@string/mmol" />
</TableRow> </TableRow>
@ -230,11 +227,11 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="DIA:" android:text="@string/dia"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText <EditText
android:id="@+id/simpleprofile_dia" android:id="@+id/circadianpercentageprofile_dia"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_column="2" android:layout_column="2"
@ -248,11 +245,11 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Absorption rate:" android:text="@string/absorption_rate"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText <EditText
android:id="@+id/simpleprofile_car" android:id="@+id/circadianpercentageprofile_car"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_column="2" android:layout_column="2"
@ -266,25 +263,23 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Target range:" android:text="@string/target_range"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText <EditText
android:id="@+id/simpleprofile_targetlow" android:id="@+id/circadianpercentageprofile_targetlow"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_column="2" android:layout_column="2"
android:inputType="numberDecimal" /> android:inputType="numberDecimal" />
<EditText <EditText
android:id="@+id/simpleprofile_targethigh" android:id="@+id/circadianpercentageprofile_targethigh"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_column="2" android:layout_column="2"
android:inputType="numberDecimal" /> android:inputType="numberDecimal" />
</TableRow> </TableRow>
</TableLayout> </TableLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View file

@ -2,10 +2,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/cardColorBackground" android:background="@color/cardColorBackground"
android:gravity="center_horizontal"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="5dp" android:paddingTop="5dp"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall">
android:gravity="center_horizontal">
<TextView <TextView
android:id="@+id/basal_time_elem" android:id="@+id/basal_time_elem"
@ -18,14 +18,14 @@
android:id="@+id/basal_edittext_elem" android:id="@+id/basal_edittext_elem"
android:layout_width="70dp" android:layout_width="70dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="numberDecimal" android:layout_marginLeft="15dp"
android:layout_marginLeft="15dp"/> android:inputType="numberDecimal"/>
<ImageView <ImageView
android:id="@+id/basal_copyprev_elem" android:id="@+id/basal_copyprev_elem"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:src="@mipmap/ic_copyprev" android:layout_marginLeft="15dp"
android:layout_marginLeft="15dp"/> android:src="@mipmap/ic_copyprev"/>
</LinearLayout> </LinearLayout>

View file

@ -347,4 +347,18 @@
<string name="button1">Button 1</string> <string name="button1">Button 1</string>
<string name="button2">Button 2</string> <string name="button2">Button 2</string>
<string name="button3">Button 3</string> <string name="button3">Button 3</string>
<string name="percentagefactor_hint">Percentage factor by which the base profile will be multiplied.</string>
<string name="timeshift_hint">Time in hours by which the profile will be shifted round robin.</string>
<string name="send_to_pump">SEND TO PUMP</string>
<string name="units">Units:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="absorption_rate">Absorption rate:</string>
<string name="target_range">Target range:</string>
<string name="edit_base_basal">Edit Base-Basal:</string>
<string name="edit_base_isf">Edit Base-ISF:</string>
<string name="edit_base_ic">Edit Base-IC:</string>
<string name="base_profile_label">Base Profile:</string>
<string name="circadian_percentage_profile">CircadianPercentageProfile</string>
</resources> </resources>