DanaR Stats small fixes and move Listeners
This commit is contained in:
parent
722976f6b0
commit
33bb7d80a6
3 changed files with 70 additions and 69 deletions
|
@ -152,36 +152,15 @@ public class DanaRStatsActivity extends Activity {
|
||||||
totalBaseBasal.setText(TBB);
|
totalBaseBasal.setText(TBB);
|
||||||
|
|
||||||
ProfileInterface pi = ConfigBuilderPlugin.getActiveProfile();
|
ProfileInterface pi = ConfigBuilderPlugin.getActiveProfile();
|
||||||
if (pi instanceof CircadianPercentageProfilePlugin){
|
if (pi != null && pi instanceof CircadianPercentageProfilePlugin){
|
||||||
totalBaseBasal.setText(decimalFormat.format(((CircadianPercentageProfilePlugin)pi).baseBasalSum()));
|
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
|
// stats table
|
||||||
tl = (TableLayout) findViewById(R.id.main_table);
|
tl = (TableLayout) findViewById(R.id.main_table);
|
||||||
TableRow tr_head = new TableRow(this);
|
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);
|
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))))){
|
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.setVisibility(View.VISIBLE);
|
||||||
statsMessage.setText(getString(R.string.danar_stats_olddata_Message));
|
statsMessage.setText(getString(R.string.danar_stats_olddata_Message));
|
||||||
|
|
||||||
|
|
|
@ -152,36 +152,15 @@ public class DanaRStatsActivity extends Activity {
|
||||||
totalBaseBasal.setText(TBB);
|
totalBaseBasal.setText(TBB);
|
||||||
|
|
||||||
ProfileInterface pi = ConfigBuilderPlugin.getActiveProfile();
|
ProfileInterface pi = ConfigBuilderPlugin.getActiveProfile();
|
||||||
if (pi instanceof CircadianPercentageProfilePlugin){
|
if (pi != null && pi instanceof CircadianPercentageProfilePlugin){
|
||||||
totalBaseBasal.setText(decimalFormat.format(((CircadianPercentageProfilePlugin)pi).baseBasalSum()));
|
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
|
// stats table
|
||||||
tl = (TableLayout) findViewById(R.id.main_table);
|
tl = (TableLayout) findViewById(R.id.main_table);
|
||||||
TableRow tr_head = new TableRow(this);
|
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);
|
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))))){
|
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.setVisibility(View.VISIBLE);
|
||||||
statsMessage.setText(getString(R.string.danar_stats_olddata_Message));
|
statsMessage.setText(getString(R.string.danar_stats_olddata_Message));
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
tools:context=".plugins.DanaR.History.DanaRHistoryActivity">
|
tools:context=".plugins.DanaR.History.DanaRHistoryActivity">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/danar_statstop"
|
android:id="@+id/danar_statstop"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -17,7 +16,6 @@
|
||||||
android:focusableInTouchMode="true"
|
android:focusableInTouchMode="true"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
|
@ -77,7 +75,6 @@
|
||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<Space
|
<Space
|
||||||
|
@ -126,7 +123,7 @@
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:layout_width="65dp"
|
android:layout_width="70dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="numberDecimal"
|
android:inputType="numberDecimal"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
|
@ -152,7 +149,7 @@
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="65dp"
|
android:layout_width="70dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:gravity="center_vertical|center_horizontal"
|
android:gravity="center_vertical|center_horizontal"
|
||||||
|
@ -161,11 +158,8 @@
|
||||||
android:id="@+id/danar_stats_editTotalBaseBasal2" />
|
android:id="@+id/danar_stats_editTotalBaseBasal2" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
@ -194,7 +188,8 @@
|
||||||
android:id="@+id/danar_stats_Message"
|
android:id="@+id/danar_stats_Message"
|
||||||
android:layout_width="350dp"
|
android:layout_width="350dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="24sp"
|
android:textSize="15sp"
|
||||||
|
android:textStyle="bold"
|
||||||
android:textColor="#ff0000"
|
android:textColor="#ff0000"
|
||||||
android:background="@drawable/pillborder"
|
android:background="@drawable/pillborder"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
|
@ -210,7 +205,5 @@
|
||||||
android:text="@string/danar_historyreload" />
|
android:text="@string/danar_historyreload" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
Loading…
Reference in a new issue