diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/History/DanaRStatsActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/History/DanaRStatsActivity.java
index 89a1fc5240..5e6d2b2c3b 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/History/DanaRStatsActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/History/DanaRStatsActivity.java
@@ -152,36 +152,15 @@ public class DanaRStatsActivity extends Activity {
totalBaseBasal.setText(TBB);
ProfileInterface pi = ConfigBuilderPlugin.getActiveProfile();
- if (pi instanceof CircadianPercentageProfilePlugin){
- totalBaseBasal.setText(decimalFormat.format(((CircadianPercentageProfilePlugin)pi).baseBasalSum()));
+ if (pi != null && pi instanceof CircadianPercentageProfilePlugin){
+ double cppTBB = ((CircadianPercentageProfilePlugin)pi).baseBasalSum();
+ totalBaseBasal.setText(decimalFormat.format(cppTBB));
+ SharedPreferences.Editor edit = preferences.edit();
+ edit.putString("TBB",totalBaseBasal.getText().toString());
+ edit.commit();
+ TBB = preferences.getString("TBB", "");
}
- totalBaseBasal.setOnEditorActionListener(new TextView.OnEditorActionListener() {
- @Override
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- if(actionId== EditorInfo.IME_ACTION_DONE){
- SharedPreferences.Editor edit = preferences.edit();
- edit.putString("TBB",totalBaseBasal.getText().toString());
- edit.commit();
- TBB = preferences.getString("TBB", "");
- loadDataFromDB(RecordTypes.RECORD_TYPE_DAILY);
- InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
- totalBaseBasal.clearFocus();
- }
- return false;
- }
- });
-
- totalBaseBasal.setOnFocusChangeListener(new View.OnFocusChangeListener() {
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- if(hasFocus){
- totalBaseBasal.getText().clear();
- }
- }
- });
-
// stats table
tl = (TableLayout) findViewById(R.id.main_table);
TableRow tr_head = new TableRow(this);
@@ -310,6 +289,32 @@ public class DanaRStatsActivity extends Activity {
}
});
+ totalBaseBasal.setOnEditorActionListener(new TextView.OnEditorActionListener() {
+ @Override
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+ if(actionId== EditorInfo.IME_ACTION_DONE){
+ SharedPreferences.Editor edit = preferences.edit();
+ edit.putString("TBB",totalBaseBasal.getText().toString());
+ edit.commit();
+ TBB = preferences.getString("TBB", "");
+ loadDataFromDB(RecordTypes.RECORD_TYPE_DAILY);
+ InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
+ totalBaseBasal.clearFocus();
+ }
+ return false;
+ }
+ });
+
+ totalBaseBasal.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if(hasFocus){
+ totalBaseBasal.getText().clear();
+ }
+ }
+ });
+
loadDataFromDB(RecordTypes.RECORD_TYPE_DAILY);
}
@@ -436,7 +441,6 @@ public class DanaRStatsActivity extends Activity {
}
if (historyList.size()<3 || !(df.format(new Date(historyList.get(0).getRecordDate())).equals(df.format(new Date(System.currentTimeMillis() - 1000*60*60*24))))){
- tl.setBackgroundColor(Color.RED);
statsMessage.setVisibility(View.VISIBLE);
statsMessage.setText(getString(R.string.danar_stats_olddata_Message));
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/History/DanaRStatsActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/History/DanaRStatsActivity.java
index c6bcd7b4fb..f1529139dc 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/History/DanaRStatsActivity.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaRKorean/History/DanaRStatsActivity.java
@@ -152,36 +152,15 @@ public class DanaRStatsActivity extends Activity {
totalBaseBasal.setText(TBB);
ProfileInterface pi = ConfigBuilderPlugin.getActiveProfile();
- if (pi instanceof CircadianPercentageProfilePlugin){
- totalBaseBasal.setText(decimalFormat.format(((CircadianPercentageProfilePlugin)pi).baseBasalSum()));
+ if (pi != null && pi instanceof CircadianPercentageProfilePlugin){
+ double cppTBB = ((CircadianPercentageProfilePlugin)pi).baseBasalSum();
+ totalBaseBasal.setText(decimalFormat.format(cppTBB));
+ SharedPreferences.Editor edit = preferences.edit();
+ edit.putString("TBB",totalBaseBasal.getText().toString());
+ edit.commit();
+ TBB = preferences.getString("TBB", "");
}
- totalBaseBasal.setOnEditorActionListener(new TextView.OnEditorActionListener() {
- @Override
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
- if(actionId== EditorInfo.IME_ACTION_DONE){
- SharedPreferences.Editor edit = preferences.edit();
- edit.putString("TBB",totalBaseBasal.getText().toString());
- edit.commit();
- TBB = preferences.getString("TBB", "");
- loadDataFromDB(RecordTypes.RECORD_TYPE_DAILY);
- InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
- totalBaseBasal.clearFocus();
- }
- return false;
- }
- });
-
- totalBaseBasal.setOnFocusChangeListener(new View.OnFocusChangeListener() {
- @Override
- public void onFocusChange(View v, boolean hasFocus) {
- if(hasFocus){
- totalBaseBasal.getText().clear();
- }
- }
- });
-
// stats table
tl = (TableLayout) findViewById(R.id.main_table);
TableRow tr_head = new TableRow(this);
@@ -310,6 +289,32 @@ public class DanaRStatsActivity extends Activity {
}
});
+ totalBaseBasal.setOnEditorActionListener(new TextView.OnEditorActionListener() {
+ @Override
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+ if(actionId== EditorInfo.IME_ACTION_DONE){
+ SharedPreferences.Editor edit = preferences.edit();
+ edit.putString("TBB",totalBaseBasal.getText().toString());
+ edit.commit();
+ TBB = preferences.getString("TBB", "");
+ loadDataFromDB(RecordTypes.RECORD_TYPE_DAILY);
+ InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
+ imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
+ totalBaseBasal.clearFocus();
+ }
+ return false;
+ }
+ });
+
+ totalBaseBasal.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if(hasFocus){
+ totalBaseBasal.getText().clear();
+ }
+ }
+ });
+
loadDataFromDB(RecordTypes.RECORD_TYPE_DAILY);
}
@@ -436,7 +441,6 @@ public class DanaRStatsActivity extends Activity {
}
if (historyList.size()<3 || !(df.format(new Date(historyList.get(0).getRecordDate())).equals(df.format(new Date(System.currentTimeMillis() - 1000*60*60*24))))){
- tl.setBackgroundColor(Color.RED);
statsMessage.setVisibility(View.VISIBLE);
statsMessage.setText(getString(R.string.danar_stats_olddata_Message));
diff --git a/app/src/main/res/layout/danar_statsactivity.xml b/app/src/main/res/layout/danar_statsactivity.xml
index 4fb2f55909..b831cd9c6f 100644
--- a/app/src/main/res/layout/danar_statsactivity.xml
+++ b/app/src/main/res/layout/danar_statsactivity.xml
@@ -7,7 +7,6 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".plugins.DanaR.History.DanaRHistoryActivity">
-
-
-
-
-
-
@@ -194,7 +188,8 @@
android:id="@+id/danar_stats_Message"
android:layout_width="350dp"
android:layout_height="wrap_content"
- android:textSize="24sp"
+ android:textSize="15sp"
+ android:textStyle="bold"
android:textColor="#ff0000"
android:background="@drawable/pillborder"
android:paddingLeft="10dp"
@@ -210,7 +205,5 @@
android:text="@string/danar_historyreload" />
-
-
\ No newline at end of file