1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-19 06:51:57 +02:00

convert received bluetooth weight automatically to scale unit

avoid null pointer exception if selected subpage is not avaiable
This commit is contained in:
OliE
2017-06-10 12:46:29 +02:00
parent d36cc0ed1b
commit da60317da6
2 changed files with 6 additions and 2 deletions

View File

@@ -211,6 +211,8 @@ public class MainActivity extends ActionBarActivity implements
setBluetoothStatusIcon(R.drawable.bluetooth_connection_success);
ScaleData scaleBtData = (ScaleData) msg.obj;
scaleBtData.setConvertedWeight(scaleBtData.getWeight(), OpenScale.getInstance(getApplicationContext()).getSelectedScaleUser().scale_unit);
if (OpenScale.getInstance(getApplicationContext()).addScaleData(scaleBtData) == -1) {
Toast.makeText(getApplicationContext(), getResources().getString(R.string.info_no_selected_user), Toast.LENGTH_SHORT).show();
}

View File

@@ -156,8 +156,10 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
}
if (subpageView.getChildCount() > 1) {
TextView selectedSubpageNrView = (TextView) subpageView.getChildAt(selectedSubpageNr + 1);
selectedSubpageNrView.setTypeface(null, Typeface.BOLD);
selectedSubpageNrView.setTextColor(ChartUtils.COLOR_BLUE);
if (selectedSubpageNrView != null) {
selectedSubpageNrView.setTypeface(null, Typeface.BOLD);
selectedSubpageNrView.setTextColor(ChartUtils.COLOR_BLUE);
}
}
Button moveSubpageRight = new Button(tableView.getContext());