DanaR Stats some improvements

This commit is contained in:
viktoria 2017-01-20 02:54:31 +01:00
parent 62853326ed
commit 2d966c9feb
3 changed files with 61 additions and 30 deletions

View file

@ -63,7 +63,7 @@ public class DanaRStatsActivity extends Activity {
private Handler mHandler;
private static HandlerThread mHandlerThread;
TextView statusView, statsMessage;
TextView statusView, statsMessage,totalBaseBasal2;
EditText totalBaseBasal;
Button reloadButton;
LinearLayoutManager llm;
@ -136,9 +136,11 @@ public class DanaRStatsActivity extends Activity {
statsMessage = (TextView) findViewById(R.id.danar_stats_Message);
statsMessage.setVisibility(View.GONE);
totalBaseBasal = (EditText) findViewById(R.id.danar_stats_editTotalBaseBasal);
totalBaseBasal2 = (TextView) findViewById(R.id.danar_stats_editTotalBaseBasal2);
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
TBB = preferences.getString("TBB", "18");
TBB = preferences.getString("TBB", "10.00");
totalBaseBasal.setHint(TBB);
totalBaseBasal.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
@ -304,27 +306,29 @@ public class DanaRStatsActivity extends Activity {
cleanTable(ctl);
cleanTable(etl);
DateFormat df = new SimpleDateFormat("dd.MM.");
if(TextUtils.isEmpty(TBB)) {
totalBaseBasal.setError("Please Enter Total Base Basal");
return;
}
else {
magicNumber = Double.parseDouble(TBB);
}
DecimalFormat decimalFormat = new DecimalFormat("0.000");
ProfileInterface pi = ConfigBuilderPlugin.getActiveProfile();
if (pi instanceof CircadianPercentageProfilePlugin){
magicNumber = ((CircadianPercentageProfilePlugin)pi).baseBasalSum();
DecimalFormat decimalFormat = new DecimalFormat("####0.000");
totalBaseBasal.setHint(decimalFormat.format(magicNumber));
totalBaseBasal.setEnabled(false);
totalBaseBasal.setClickable(false);
totalBaseBasal.setFocusable(false);
totalBaseBasal.setInputType(0);
}
} else {
if(TextUtils.isEmpty(TBB)) {
totalBaseBasal.setError("Please Enter Total Base Basal");
return;
}
else {
magicNumber = Double.parseDouble(TBB);
}
}
magicNumber *=2;
totalBaseBasal2.setHint(decimalFormat.format(magicNumber));
int i = 0;
double sum = 0d;

View file

@ -113,25 +113,54 @@
<Space
android:layout_width="10dp"
android:layout_height="30dp" />
android:layout_height="10dp" />
<EditText
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="18"
android:textSize="50px"
android:gravity="center"
android:inputType="numberDecimal"
android:id="@+id/danar_stats_editTotalBaseBasal" />
android:layout_height="match_parent">
<TextView
android:text="@string/danar_stats_tbb"
android:labelFor="@+id/danar_stats_editTotalBaseBasal"
<TextView
android:text="@string/danar_stats_tbb"
android:labelFor="@+id/danar_stats_editTotalBaseBasal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/danar_stats_editTotalBaseBasal_label"
android:gravity="left"
android:layout_weight="1" />
<EditText
android:layout_width="79dp"
android:layout_height="wrap_content"
android:textSize="50px"
android:gravity="center"
android:inputType="numberDecimal"
android:id="@+id/danar_stats_editTotalBaseBasal" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/danar_stats_editTotalBaseBasal_label"
android:gravity="center"
android:layout_weight="1" />
android:layout_height="match_parent">
<TextView
android:text="@string/danar_stats_tbb2"
android:labelFor="@+id/danar_stats_editTotalBaseBasal2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/danar_stats_editTotalBaseBasal2_label"
android:gravity="left"
android:layout_weight="1" />
<TextView
android:layout_width="79dp"
android:layout_height="wrap_content"
android:textSize="50px"
android:gravity="center"
android:inputType="numberDecimal"
android:id="@+id/danar_stats_editTotalBaseBasal2" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -425,8 +425,6 @@
<string name="danar_stats_warning_Message">Possibly inaccurate if using boluses for priming/filling!</string>
<string name="danar_stats_olddata_Message">Old Data Please Press "RELOAD"</string>
<string name="danar_stats_tbb">Total Base Basal</string>
<string name="danar_stats_skipMessageButton">Display Alert Message Again</string>
<string name="danar_stats_skipMessageCheckbox">Please do not show again</string>
<string name="danar_stats_skipMessage">Possibly inaccurate if using boluses for priming/filling!</string>
<string name="danar_stats_tbb2">Total Base Basal ²</string>
<string name="initializing">Initializing ...</string>
</resources>