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

View file

@ -113,25 +113,54 @@
<Space <Space
android:layout_width="10dp" android:layout_width="10dp"
android:layout_height="30dp" /> android:layout_height="10dp" />
<EditText <LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent">
android:hint="18"
android:textSize="50px"
android:gravity="center"
android:inputType="numberDecimal"
android:id="@+id/danar_stats_editTotalBaseBasal" />
<TextView <TextView
android:text="@string/danar_stats_tbb" android:text="@string/danar_stats_tbb"
android:labelFor="@+id/danar_stats_editTotalBaseBasal" 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_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent">
android:id="@+id/danar_stats_editTotalBaseBasal_label"
android:gravity="center" <TextView
android:layout_weight="1" /> 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>
</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_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_olddata_Message">Old Data Please Press "RELOAD"</string>
<string name="danar_stats_tbb">Total Base Basal</string> <string name="danar_stats_tbb">Total Base Basal</string>
<string name="danar_stats_skipMessageButton">Display Alert Message Again</string> <string name="danar_stats_tbb2">Total Base Basal ²</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="initializing">Initializing ...</string> <string name="initializing">Initializing ...</string>
</resources> </resources>