DanaR Stats some improvements
This commit is contained in:
parent
62853326ed
commit
2d966c9feb
3 changed files with 61 additions and 30 deletions
|
@ -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,6 +306,17 @@ 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");
|
||||||
|
|
||||||
|
ProfileInterface pi = ConfigBuilderPlugin.getActiveProfile();
|
||||||
|
if (pi instanceof CircadianPercentageProfilePlugin){
|
||||||
|
magicNumber = ((CircadianPercentageProfilePlugin)pi).baseBasalSum();
|
||||||
|
totalBaseBasal.setHint(decimalFormat.format(magicNumber));
|
||||||
|
totalBaseBasal.setEnabled(false);
|
||||||
|
totalBaseBasal.setClickable(false);
|
||||||
|
totalBaseBasal.setFocusable(false);
|
||||||
|
totalBaseBasal.setInputType(0);
|
||||||
|
} else {
|
||||||
|
|
||||||
if(TextUtils.isEmpty(TBB)) {
|
if(TextUtils.isEmpty(TBB)) {
|
||||||
totalBaseBasal.setError("Please Enter Total Base Basal");
|
totalBaseBasal.setError("Please Enter Total Base Basal");
|
||||||
|
@ -313,18 +326,9 @@ public class DanaRStatsActivity extends Activity {
|
||||||
magicNumber = Double.parseDouble(TBB);
|
magicNumber = Double.parseDouble(TBB);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
magicNumber *=2;
|
magicNumber *=2;
|
||||||
|
totalBaseBasal2.setHint(decimalFormat.format(magicNumber));
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
double sum = 0d;
|
double sum = 0d;
|
||||||
|
|
|
@ -113,16 +113,12 @@
|
||||||
|
|
||||||
<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"
|
||||||
|
@ -130,9 +126,42 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/danar_stats_editTotalBaseBasal_label"
|
android:id="@+id/danar_stats_editTotalBaseBasal_label"
|
||||||
android:gravity="center"
|
android:gravity="left"
|
||||||
android:layout_weight="1" />
|
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="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>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue