DanaR Stats fixes

This commit is contained in:
viktoria 2017-01-18 04:31:47 +01:00
parent 9ba24b4ffd
commit b70e895b95
3 changed files with 45 additions and 31 deletions

View file

@ -14,6 +14,7 @@ import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.v7.widget.LinearLayoutManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
@ -137,15 +138,15 @@ public class DanaRStatsActivity extends Activity {
totalBaseBasal = (EditText) findViewById(R.id.danar_stats_editTotalBaseBasal);
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
TBB = preferences.getString("TBB", "10");
TBB = preferences.getString("TBB", "18");
totalBaseBasal.setHint(TBB);
totalBaseBasal.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
SharedPreferences.Editor edit = preferences.edit();
edit.putString("TBB",totalBaseBasal.getText().toString());
edit.commit();
loadDataFromDB(RecordTypes.RECORD_TYPE_DAILY);
TBB = preferences.getString("TBB", "");
loadDataFromDB(RecordTypes.RECORD_TYPE_DAILY);
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@ -304,9 +305,13 @@ public class DanaRStatsActivity extends Activity {
cleanTable(etl);
DateFormat df = new SimpleDateFormat("dd.MM.");
magicNumber = 18d;
String[] separatedTBB = TBB.split(" ");
magicNumber = Double.parseDouble(separatedTBB[0]);
if(TextUtils.isEmpty(TBB)) {
totalBaseBasal.setError("Please Enter Total Base Basal");
return;
}
else {
magicNumber = Double.parseDouble(TBB);
}
ProfileInterface pi = ConfigBuilderPlugin.getActiveProfile();
if (pi instanceof CircadianPercentageProfilePlugin){

View file

@ -14,6 +14,7 @@ import android.os.IBinder;
import android.preference.PreferenceManager;
import android.support.v7.widget.LinearLayoutManager;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
@ -137,15 +138,15 @@ public class DanaRStatsActivity extends Activity {
totalBaseBasal = (EditText) findViewById(R.id.danar_stats_editTotalBaseBasal);
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
TBB = preferences.getString("TBB", "10");
TBB = preferences.getString("TBB", "18");
totalBaseBasal.setHint(TBB);
totalBaseBasal.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
SharedPreferences.Editor edit = preferences.edit();
edit.putString("TBB",totalBaseBasal.getText().toString());
edit.commit();
loadDataFromDB(RecordTypes.RECORD_TYPE_DAILY);
TBB = preferences.getString("TBB", "");
loadDataFromDB(RecordTypes.RECORD_TYPE_DAILY);
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@ -304,9 +305,13 @@ public class DanaRStatsActivity extends Activity {
cleanTable(etl);
DateFormat df = new SimpleDateFormat("dd.MM.");
magicNumber = 18d;
String[] separatedTBB = TBB.split(" ");
magicNumber = Double.parseDouble(separatedTBB[0]);
if(TextUtils.isEmpty(TBB)) {
totalBaseBasal.setError("Please Enter Total Base Basal");
return;
}
else {
magicNumber = Double.parseDouble(TBB);
}
ProfileInterface pi = ConfigBuilderPlugin.getActiveProfile();
if (pi instanceof CircadianPercentageProfilePlugin){

View file

@ -90,7 +90,9 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true">
<TextView
android:layout_width="match_parent"
@ -109,6 +111,28 @@
android:layout_weight="1">
</TableLayout>
<Space
android:layout_width="10dp"
android:layout_height="30dp" />
<EditText
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" />
<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="center"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
@ -135,26 +159,6 @@
android:layout_height="match_parent"
android:layout_weight="1">
<EditText
android:layout_width="70dp"
android:layout_height="wrap_content"
android:hint="TBB"
android:ems="10"
android:gravity="center"
android:inputType="numberDecimal"
android:id="@+id/danar_stats_editTotalBaseBasal" />
<TextView
android:text="@string/danar_stats_tbb"
android:labelFor="@+id/danar_stats_editTotalBaseBasal"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:id="@+id/danar_stats_editTotalBaseBasal_label"
android:gravity="top" />
<Space
android:layout_width="match_parent"
android:layout_height="20dp" />
<TextView
android:id="@+id/danar_stats_Message"